PageSourceSearch

https://blacktieauctions.biz/wp-content/themes/P2PTheme/js/scripts.js?ver=17.8.6

js blacktieauctions.biz collected 2026-10-06 04:06:14 UTC 76,099 bytes, 2,870 lines download raw bytes

1(function($){
2
3    "use strict";
4
5
6    /* ---------------------------------------------------------------------------
7	 * Global vars
8	 * --------------------------------------------------------------------------- */
9
10    var scrollticker;	// Scroll Timer | don't need to set this in every scroll
11    
12    var rtl 			= $( 'body' ).hasClass( 'rtl' );
13    var simple			= $( 'body' ).hasClass( 'style-simple' );
14    
15    var top_bar_top 	= '61px';
16    var header_H 		= 0;
17    var mobile_init_W 	= ( window.mfn.mobile_init ) ? window.mfn.mobile_init : 1240;
18
19    var lightbox_attr 	= false;
20    
21    
22    /* ---------------------------------------------------------------------------
23	 * Lightbox | Magnific Popup
24	 * --------------------------------------------------------------------------- */
25
26    if( ! window.mfn_lightbox.disable ){
27    	if( ! ( window.mfn_lightbox.disableMobile && ( window.innerWidth < 768 ) ) ){
28    		lightbox_attr = {
29				title : window.mfn_lightbox.title  ? window.mfn_lightbox.title  : false,
30    		};
31    	}
32    } 
33    
34    
35    /* ---------------------------------------------------------------------------
36	 * Admin Bar & WooCommerce Store Notice
37	 * --------------------------------------------------------------------------- */
38    
39    function adminBarH(){
40    	var height = 0;
41    	
42    	// WP adminbar
43    	if( $( 'body' ).hasClass( 'admin-bar' ) ){
44    		height += $( '#wpadminbar' ).innerHeight();
45    	}
46    	
47    	// WC demo store
48    	if( $( 'body' ).hasClass( 'woocommerce-demo-store' ) ){
49    		height += $( 'body > p.demo_store' ).innerHeight();
50    	}
51    	
52    	return height;
53    }
54
55    
56    /* ---------------------------------------------------------------------------
57	 * Header | Sticky
58	 * --------------------------------------------------------------------------- */
59    
60	function mfn_sticky(){
61		if( $( 'body' ).hasClass( 'sticky-header' ) ){	
62			if( ! ( $( 'body' ).hasClass( 'header-creative' ) && window.innerWidth >= 768 ) ){
63
64				var start_y = header_H;
65				var window_y = $(window).scrollTop();
66		
67				if( window_y > start_y ){
68					
69					if( ! ( $( '#Top_bar' ).hasClass( 'is-sticky' ) ) ){
70
71						$( '.header_placeholder' ).css( 'height', $( '#Top_bar' ).height() );
72						
73						$( '#Top_bar' )
74							.addClass( 'is-sticky' )
75							.css( 'top', -60 )
76							.animate({
77								'top': adminBarH() + 'px'
78							}, 300 );
79						
80						// Header width
81						mfn_header();
82					}
83					
84				} else {
85					
86					if( $( '#Top_bar' ).hasClass( 'is-sticky' ) ){
87						
88						$( '.header_placeholder' ).css( 'height', 0 );
89						$( '#Top_bar' )
90							.removeClass( 'is-sticky' )
91							.css( 'top', top_bar_top );
92						
93						// Retina Logo - max height
94						sticky_logo();
95						
96						// Header width
97						mfn_header();
98						
99					}
100					
101				}
102				
103				mfn_mobile_sticky();
104			
105			}
106		}
107	}
108	
109	
110	/* ---------------------------------------------------------------------------
111	 * Header | Sticky | Retina Logo - max height
112	 * --------------------------------------------------------------------------- */
113	function sticky_logo(){
114		
115		// ! retina display
116		if( ! window.devicePixelRatio > 1 ){
117			return false;
118		}
119		
120		var parent = $( '#Top_bar #logo' );
121		
122		// ! retina logo set
123		if( ! parent.hasClass( 'retina' ) ){
124			return false;
125		}
126			
127		var el = $( 'img.logo-main', parent );
128		var height = el.data( 'height' );
129		
130		if( $( 'body' ).hasClass( 'logo-overflow' ) ){
131			// do nothing
132		} else if( height > parent.data( 'height' ) ){
133			height = parent.data( 'height' );
134		}
135		
136		el.css( 'max-height', height + 'px' );
137		
138	}
139	
140	/* ---------------------------------------------------------------------------
141	 * Header | Sticky | Height
142	 * --------------------------------------------------------------------------- */
143	
144	function mfn_stickyH(){
145
146    	if( $('body').hasClass( 'header-below' ) ){
147    		
148	    	// header below slider
149	    	header_H = $( '.mfn-main-slider' ).innerHeight() + $( '#Top_bar' ).innerHeight();
150	    	
151	    } else {
152	    	
153	    	// default
154	    	header_H = $( '#Top_bar' ).innerHeight() + $( '#Action_bar' ).innerHeight();
155	    	
156	    }
157    	
158    }
159    
160
161    /* ---------------------------------------------------------------------------
162	 * Header | Sticky | Mobile
163	 * --------------------------------------------------------------------------- */
164    
165	function mfn_mobile_sticky(){
166		if( $( 'body' ).hasClass( 'mobile-sticky' ) && ( $( window ).width() < 768 ) ){
167
168			var windowH = $(window).height();
169			var offset = adminBarH() + $( '#Top_bar .logo' ).height();
170
171			if( ( ! $( '#Top_bar' ).hasClass( 'is-sticky' ) ) && $( '#Action_bar' ).is( ':visible' ) ){
172				offset += $( '#Action_bar' ).height();
173			}					
174
175			var menuH = windowH - offset;
176			if( menuH < 176 ){
177				menuH = 176;
178			}
179			
180			$( '#Top_bar #menu' ).css( 'max-height', menuH + 'px' );
181			
182		}
183	}
184	
185	
186	/* ---------------------------------------------------------------------------
187	 * Header | Top bar left | Width
188	 * --------------------------------------------------------------------------- */
189	
190	function mfn_header(){
191		var rightW = $('.top_bar_right').innerWidth();
192		if( rightW && ! $('body').hasClass('header-plain') ){
193			rightW += 10;
194		}
195		var parentW = $('#Top_bar .one').innerWidth();
196		var leftW = parentW - rightW;
197		$('.top_bar_left, .menu > li > ul.mfn-megamenu').css( 'width', leftW );
198	}
199	
200	
201	/* ---------------------------------------------------------------------------
202	 * FIX | Header | Sticky | Height
203	 * --------------------------------------------------------------------------- */
204	
205	function fixStickyHeaderH(){
206		var stickyH = 0;
207		
208		// FIX | sticky top bar height
209		
210		var topBar = $( '.sticky-header #Top_bar' );
211		
212		if( topBar.hasClass( 'is-sticky' ) ){
213			stickyH = $( '.sticky-header #Top_bar' ).innerHeight();
214		} else {
215			topBar.addClass( 'is-sticky' );
216			stickyH = $( '.sticky-header #Top_bar' ).innerHeight();
217			topBar.removeClass( 'is-sticky' );
218		}
219
220		// FIX | responsive
221
222		if( $( window ).width() < mobile_init_W  ){
223
224			if( $( window ).width() < 768 ){
225				
226				// mobile
227				if( ! $( 'body' ).hasClass( 'mobile-sticky' ) ){
228					stickyH = 0;
229				}
230				
231			} else {
232				
233				// tablet
234				if( ! $( 'body' ).hasClass( 'tablet-sticky' ) ){
235					stickyH = 0;
236				}
237				
238			}
239
240		} else {
241			
242			// desktop
243			
244			// FIX | header creative			
245			if( $( 'body' ).hasClass( 'header-creative' ) ){
246				stickyH = 0;
247			}
248
249		}
250		
251		return stickyH;
252	}
253
254	
255	/* ---------------------------------------------------------------------------
256	 * Sidebar | Height
257	 * --------------------------------------------------------------------------- */
258	
259	function mfn_sidebar(){
260		if( $('.with_aside .four.columns').length ){
261			
262			var maxH = $('#Content .sections_group').outerHeight();
263
264			$('.with_aside .four.columns .widget-area').each(function(){
265				$(this).css( 'min-height', 0 );
266				if( $(this).height() > maxH ){
267					maxH = $(this).height();
268				}
269			});
270			$('.with_aside .four.columns .widget-area').css( 'min-height', maxH + 'px' );
271			
272		}
273	}
274	
275	
276	/* ---------------------------------------------------------------------------
277	 * Section | Full Screen 
278	 * --------------------------------------------------------------------------- */
279	
280	function mfn_sectionH(){
281		var windowH = $(window).height();
282		
283		// FIX | next/prev section
284		var offset = 0;	
285		if( $( '.section.full-screen:not(.hide-desktop)' ).length > 1 ){
286			offset = 5;
287		}
288
289		$( '.section.full-screen' ).each( function(){
290			
291			var section = $( this );
292			var wrapper = $( '.section_wrapper', section );
293
294			section
295				.css( 'padding', 0 )
296				.css( 'min-height', windowH + offset );
297			
298			var padding = ( windowH + offset - wrapper.height() ) / 2;
299			
300			if( padding < 50 ) padding = 50;
301			
302			wrapper
303				.css( 'padding-top', padding + 10 )			// 20 = column margin-bottom / 2
304				.css( 'padding-bottom', padding - 10 );
305		});
306	}
307	
308	
309	/* ---------------------------------------------------------------------------
310	 * Equal Height | Wraps
311	 * --------------------------------------------------------------------------- */
312	
313	function mfn_equalH_wrap(){
314		$('.section.equal-height-wrap .section_wrapper').each(function(){
315			var maxH = 0;
316			$('> .wrap', $(this) ).each(function(){
317				$(this).css( 'height', 'auto' );
318				if( $(this).innerHeight() > maxH ){
319					maxH = $(this).innerHeight();
320				}
321			});
322			$('> .wrap', $(this) ).css( 'height', maxH + 'px' );
323		});
324	}
325	
326	
327	/* ---------------------------------------------------------------------------
328	 * Equal Height | Items
329	 * --------------------------------------------------------------------------- */
330	
331	function mfn_equalH(){
332		$('.section.equal-height .mcb-wrap-inner').each(function(){
333			var maxH = 0;
334
335			$('> .column', $(this) ).each(function(){
336				$(this).css( 'height', 'auto' );
337				if( $(this).height() > maxH ){
338					maxH = $(this).height();
339				}
340			});
341			$('> .column', $(this) ).css( 'height', maxH + 'px' );
342		});
343	}	
344	
345	
346	/* ---------------------------------------------------------------------------
347	 * Into | Full Screen
348	 * --------------------------------------------------------------------------- */
349	
350	function mfn_introH(){
351		var windowH = $(window).height() - $('#Header_wrapper').height() - adminBarH();
352		
353		$('#Intro.full-screen').each(function(){
354			
355			var el = $(this);
356			var inner = $( '.intro-inner', el );
357			
358			el.css( 'padding', 0 ).css( 'min-height', windowH );
359			
360			var padding = ( windowH - inner.height() ) / 2;
361			inner.css( 'padding-top', padding ).css( 'padding-bottom', padding );
362			
363		});
364	}
365	
366	
367	/* ---------------------------------------------------------------------------
368	 * Footer | Sliding | Height
369	 * --------------------------------------------------------------------------- */
370	
371	function mfn_footer(){
372		
373		// Fixed, Sliding
374		if( $('.footer-fixed #Footer, .footer-sliding #Footer').length ){
375			
376			var footerH = $('#Footer').height() - 1;
377			$('#Content').css( 'margin-bottom', footerH + 'px' );
378			
379		}
380		
381		// Stick to bottom
382		if( $('.footer-stick #Footer').length ){
383			
384			var headerFooterH 	= $('#Header_wrapper').height() + $('#Footer').height();
385			var documentH 		= $(document).height() - adminBarH();
386					
387			if( ( documentH <= $(window).height() ) && ( headerFooterH <= $(window).height() ) ){ 
388				$('#Footer').addClass('is-sticky');
389			} else {
390				$('#Footer').removeClass('is-sticky');
391			}
392			
393		}
394		
395	}
396	
397	
398	/* ---------------------------------------------------------------------------
399	 * Back To Top | Sticky / Show on scroll
400	 * --------------------------------------------------------------------------- */
401	
402	function backToTopSticky(){
403
404		if( $('#back_to_top.sticky.scroll').length ){			
405			var el = $('#back_to_top.sticky.scroll');
406		
407			// Clear Timeout if one is pending
408			if( scrollticker ){
409				window.clearTimeout(scrollticker);
410				scrollticker = null;
411			}
412				
413			el.addClass('focus');
414		
415			// Set Timeout
416			scrollticker = window.setTimeout(function(){
417				el.removeClass('focus');
418			}, 1500); // Timeout in msec
419			
420		}
421
422	}
423	
424
425	/* ---------------------------------------------------------------------------
426	 * niceScroll | Padding right fix for short content
427	 * --------------------------------------------------------------------------- */
428	
429	function niceScrollFix(){
430		var el = $('body > .nicescroll-rails');
431		if( el.length ){
432			if( el.is(":visible") ){
433				$('body').addClass('nice-scroll');
434			} else {
435				$('body').removeClass('nice-scroll');
436			}
437		}
438	}
439	
440	
441	/* ---------------------------------------------------------------------------
442	 * # Hash smooth navigation
443	 * --------------------------------------------------------------------------- */
444	
445	function hashNav(){
446		
447		// # window.location.hash
448		var hash = window.location.hash;
449		
450		if( hash ){
451		
452			// FIX | Master Slider
453			if( hash.indexOf( "&" ) > -1 || hash.indexOf( "/" ) > -1 ){
454				return false;
455			}
456			
457			// Contact Form 7 in popup
458			if( hash.indexOf( "wpcf7" ) > -1 ){
459				cf7popup( hash );
460			}
461			
462			if( $( hash ).length ){	
463				
464				var tabsHeaderH = $( hash ).siblings( '.ui-tabs-nav' ).innerHeight();
465				
466				$( 'html, body' ).animate({ 
467					scrollTop: $( hash ).offset().top - fixStickyHeaderH() - tabsHeaderH - adminBarH()
468				}, 500 );
469			}
470			
471		}
472		
473	}
474	
475	
476	/* ---------------------------------------------------------------------------
477	 * One Page | Scroll Active
478	 * --------------------------------------------------------------------------- */
479	
480	function onePageActive(){
481		if( $('body').hasClass('one-page') ){	
482			
483			var stickyH	= $('.sticky-header #Top_bar').innerHeight();
484			var windowT = $(window).scrollTop();
485			var start	= windowT + stickyH + adminBarH() + 1;		
486			var first 	= false;
487			
488			$('div[data-id]').each(function(){
489				
490				if( $(this).visible( true ) ){		
491					if( !first ){
492						first = $(this);
493					} else if( ( $(this).offset().top < start ) && ( $(this).offset().top > first.offset().top ) ) {
494						first = $(this);
495					}
496				}
497
498				if( first ){
499					var newActive = first.attr('data-id');        
500			        var active = '[data-hash="'+ newActive +'"]';
501			        
502			        if( newActive ){
503				        var menu = $('#menu');
504				        menu.find('li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current_page_item current_page_parent current_page_ancestor');
505				        $( active, menu )
506				        	.closest('li').addClass('current-menu-item')
507				        	.closest('.menu > li').addClass('current-menu-item');
508			        }
509				}
510			
511			});
512	        
513		}
514	}
515	
516	
517	/* ---------------------------------------------------------------------------
518	 * Contact Form 7 | Popup
519	 * --------------------------------------------------------------------------- */
520	
521	function cf7popup( hash ){
522		if( hash && $( hash ).length ){	
523			var id = $( hash ).closest('.popup-content').attr('id');
524
525			$('a.popup-link[href="#'+ id +'"]:not(.once)')
526				.addClass('once')
527				.click();
528			
529		}
530	}
531	
532		
533	/* ---------------------------------------------------------------------------
534	 * Zoom Box | Vertical Align
535	 * --------------------------------------------------------------------------- */
536	
537	function zoomBoxVerticalAlign(){
538		$('.zoom_box').each(function(){
539			
540            var el = $(this);
541            var elH = el.height(); 
542            var desc = el.find('.desc_wrap');
543            var descH = desc.height(); 
544            
545            var padding = ( elH - descH ) / 2;
546            
547            desc.css( 'padding-top', padding +'px' );
548
549        });
550	}
551
552	
553	
554	/* --------------------------------------------------------------------------------------------------------------------------
555	 * 
556	 * $(document).ready
557	 * 
558	 * ----------------------------------------------------------------------------------------------------------------------- */
559	
560	
561	$(document).ready(function(){
562	
563		
564		/* ---------------------------------------------------------------------------
565		 * Top Bar
566		 * --------------------------------------------------------------------------- */
567		
568		$( '#Top_bar' ).removeClass( 'loading' );
569		
570		top_bar_top = parseInt( $('#Top_bar').css('top'), 10 );
571		if( top_bar_top < 0 ) top_bar_top = 61;
572		top_bar_top = top_bar_top + 'px';
573
574		
575		/* ---------------------------------------------------------------------------
576		 * Menu | Overlay
577		 * --------------------------------------------------------------------------- */
578		
579		$( '.overlay-menu-toggle' ).click( function(e){
580			e.preventDefault();
581			
582			$(this).toggleClass('focus');
583			$( '#Overlay' ).stop(true,true).fadeToggle(500);
584			
585			var menuH = $('#Overlay nav').height() / 2;
586			$( '#Overlay nav' ).css( 'margin-top', '-' + menuH + 'px' );	
587		});
588		
589		
590		/* ---------------------------------------------------------------------------
591		 * Menu | Responsive | button
592		 * --------------------------------------------------------------------------- */
593		
594		$( '.responsive-menu-toggle' ).on( 'click', function(e){
595			e.preventDefault();
596
597			var el = $(this);
598			var menu = $('#Top_bar #menu');
599			var menuWrap = menu.closest('.top_bar_left');
600			
601			el.toggleClass('active');
602			
603			// sticky menu button
604			if( el.hasClass('is-sticky') && el.hasClass('active') && ( window.innerWidth < 768 ) ){
605				
606				var top = 0;
607				if( menuWrap.length ){
608					top = menuWrap.offset().top - adminBarH();				
609				}
610				$('body,html').animate({
611					scrollTop: top
612				}, 200);
613				
614			}
615
616			menu.stop(true,true).slideToggle(200);
617		});
618
619		
620		/* ---------------------------------------------------------------------------
621		 * Menu | Responsive | Side Slide
622		 * --------------------------------------------------------------------------- */
623		
624		function sideSlide(){
625	
626			var slide 				= $( '#Side_slide' );
627			var overlay 			= $( '#body_overlay' );
628			var ss_mobile_init_W 	= mobile_init_W;
629			var pos 				= 'right';
630		
631			
632			// constructor ----------
633			
634			var constructor = function(){
635				if( ! slide.hasClass( 'enabled' ) ){
636					$( 'nav#menu' ).detach().appendTo( '#Side_slide .menu_wrapper' );
637					slide.addClass( 'enabled' );
638				}
639			};
640			
641			
642			// destructor ----------
643			
644			var destructor = function(){
645				if( slide.hasClass( 'enabled' ) ){
646					close();
647					$( 'nav#menu' ).detach().prependTo( '#Top_bar .menu_wrapper' );
648					slide.removeClass( 'enabled' );
649				}
650			};
651			
652			
653			// reload ----------
654			
655			var reload = function(){
656
657				if( ( window.innerWidth < ss_mobile_init_W ) ){
658					constructor();
659				} else {
660					destructor();
661				}
662			};
663			
664			
665			// init ----------
666			
667			var init = function(){
668				if( slide.hasClass( 'left' ) ){
669					pos = 'left';
670				}
671
672				// responsive off
673				if( $( 'body' ).hasClass( 'responsive-off' ) ){
674					ss_mobile_init_W = 0;
675				}
676				
677				// header simple
678				if( $( 'body' ).hasClass( 'header-simple' ) ){
679					ss_mobile_init_W = 9999;
680				}
681
682				reload();
683			};
684			
685			
686			// reset to default ----------
687			
688			var reset = function( time ){
689				
690				$( '.lang-active.active', slide ).removeClass('active').children('i').attr('class','icon-down-open-mini');
691				$( '.lang-wrapper', slide ).fadeOut(0);
692				
693				$( '.icon.search.active', slide ).removeClass('active');
694				$( '.search-wrapper', slide ).fadeOut(0);
695				
696				$( '.menu_wrapper, .social', slide ).fadeIn( time );
697				
698			};
699			
700			
701			// menu button ----------
702			
703			var button = function(){
704				
705				// show
706				if( pos == 'left' ){
707					slide.animate({ 'left':0 },300);
708					$('body').animate({ 'right':-125 },300);
709				} else {
710					slide.animate({ 'right':0 },300);
711					$('body').animate({ 'left':-125 },300);
712				}
713				
714				overlay.fadeIn(300);
715				
716				// reset
717				reset(0);
718				
719			};
720
721			
722			// close ----------
723			
724			var close = function(){
725				
726				if( pos == 'left' ){
727					slide.animate({ 'left':-250 },300);
728					$('body').animate({ 'right':0 },300);
729				} else {
730					slide.animate({ 'right':-250 },300);
731					$('body').animate({ 'left':0 },300);
732				}
733				
734				overlay.fadeOut(300);
735			};
736
737			
738			// search ----------
739			
740			$( '.icon.search', slide ).on( 'click', function(e){
741				
742				e.preventDefault();
743				
744				var el = $(this);
745				
746				if( el.hasClass('active') ){
747					
748					$( '.search-wrapper', slide ).fadeOut(0);
749					$( '.menu_wrapper, .social', slide ).fadeIn(300);
750					
751				} else {
752					
753					$( '.search-wrapper', slide ).fadeIn(300);
754					$( '.menu_wrapper, .social', slide ).fadeOut(0);
755					
756					$( '.lang-active.active', slide ).removeClass('active').children('i').attr('class','icon-down-open-mini');
757					$( '.lang-wrapper', slide ).fadeOut(0);
758					
759				}
760				
761				el.toggleClass('active');
762			});
763			
764			
765			// search form submit ----------
766			
767			$( 'a.submit', slide ).on( 'click', function(e){
768				e.preventDefault();
769				$('#side-form').submit();
770			});
771			
772			
773			// lang menu ----------
774			
775			$( '.lang-active', slide ).on( 'click', function(e){
776				e.preventDefault();
777				
778				var el = $(this);
779				
780				if( el.hasClass('active') ){
781					
782					$( '.lang-wrapper', slide ).fadeOut(0);
783					$( '.menu_wrapper, .social', slide ).fadeIn(300);
784					el.children('i').attr('class','icon-down-open-mini');
785					
786				} else {
787					
788					$( '.lang-wrapper', slide ).fadeIn(300);
789					$( '.menu_wrapper, .social', slide ).fadeOut(0);
790					el.children('i').attr('class','icon-up-open-mini');
791					
792					$( '.icon.search.active', slide ).removeClass('active');
793					$( '.search-wrapper', slide ).fadeOut(0);
794					
795				}
796				
797				el.toggleClass('active');
798			});
799			
800			
801			// init, click, debouncedresize ----------
802			
803			// init
804			
805			init();
806			
807			// click | menu button
808			
809			$( '.responsive-menu-toggle' ).off( 'click' );
810			
811			$( '.responsive-menu-toggle' ).on( 'click', function(e){
812				e.preventDefault();
813				button();			
814			});
815			
816			// click | close
817			
818			overlay.on( 'click', function(e){
819				close();
820			});
821			
822			$( '.close', slide ).on( 'click', function(e){
823				e.preventDefault();
824				close();
825			});
826			
827			// click | below search or languages menu
828			
829			$( slide ).on( 'click', function(e){
830				if( $( e.target ).is( slide ) ){
831					reset(300);
832				}
833			});
834			
835			// debouncedresize
836			
837			$( window ).on( 'debouncedresize', reload );
838			
839			
840		}
841	
842		if( $( 'body' ).hasClass( 'mobile-side-slide' ) ){
843			sideSlide();
844		}
845		
846		
847		/* ---------------------------------------------------------------------------
848		 * Gallery | WordPress Gallery
849		 * --------------------------------------------------------------------------- */
850        
851		$('.gallery').each(function(){
852			
853			var el = $(this);
854			var parentID = el.attr( 'id' );
855			
856			$( '> br', el ).remove();
857			
858			$( '.gallery-icon > a', el )
859				.wrap( '<div class="image_frame scale-with-grid"><div class="image_wrapper"></div></div>' )
860				.prepend( '<div class="mask"></div>' )
861				.children( 'img' )
862					.css( 'height', 'auto' )
863					.css( 'width', '100%' );
864
865			// Link | Media File
866			if( el.hasClass( 'file' ) ){
867				$( '.gallery-icon a', el ).attr( 'rel', 'prettyphoto['+ parentID +']' );
868			}
869			
870			// Masonry
871			if( el.hasClass( 'masonry' ) ){
872
873				el.isotope({
874					itemSelector	: '.gallery-item',
875					layoutMode		: 'masonry',
876					isOriginLeft	: rtl ? false : true
877				});
878				
879			}
880			
881		});
882
883		
884		/* ---------------------------------------------------------------------------
885		 * Lightbox | PrettyPhoto
886		 * --------------------------------------------------------------------------- */
887		
888		$( 'a[rel^="prettyphoto[portfolio]"]' ).each(function(){
889			
890			var el = $(this);
891			var parent = el.closest( '.column' );
892			var index = $( '.column' ).index( parent );
893			
894			el.attr( 'rel', 'prettyphoto[portfolio-'+ index +']' );
895			
896		});
897		
898
899		/* ---------------------------------------------------------------------------
900		 * Lightbox | Magnific Popup
901		 * with prettyPhoto backward compatibility
902		 * --------------------------------------------------------------------------- */
903
904		function lightbox(){
905			
906			var galleries = [];
907			
908			
909			// init -----------
910			
911			var init = function(){
912				
913				if( lightbox_attr ){
914					compatibility();
915					set_type();
916					constructor();
917				}
918				
919			};
920			
921			
922			// backward compatibility for prettyPhoto ----------
923			
924			var compatibility = function(){
925				
926				$( 'a[rel^="prettyphoto"], a.prettyphoto, a[rel^="prettyphoto"]' ).each(function(){
927					
928					var el 	= $( this );
929					var rel = el.attr( 'rel' );
930
931					if( rel ){
932						rel = rel.replace( 'prettyphoto', 'lightbox' );
933					} else {
934						rel = 'lightbox';
935					}
936					
937					// Visual Composer prettyPhoto
938					var data_rel = el.attr( 'data-rel' );
939					if( data_rel ){
940						rel = data_rel.replace( 'prettyPhoto', 'lightbox' );
941						el.removeAttr( 'data-rel' );
942					}
943					
944					el.removeClass( 'prettyphoto' ).attr( 'rel', rel );
945
946				});
947
948			};
949			
950			
951			// check if item is a part of gallery ----------
952			
953			var is_gallery = function( rel ){
954				
955				if( ! rel ){
956					return false;
957				}
958				
959				var reg_exp = /\[(?:.*)\]/;
960				var gallery = reg_exp.exec( rel );
961				
962				if( gallery ){
963					gallery = gallery[0];
964					gallery = gallery.replace( '[','' ).replace( ']','' );
965					return gallery;
966				}
967				
968				return false;
969			};
970			
971			
972			// set array of names of galleries ----------
973			
974			var set_gallery = function( gallery ){
975				
976				if( galleries.indexOf( gallery ) == -1 ){
977					galleries.push( gallery );
978					return true;
979				}
980				
981				return false;
982			};
983			
984
985			// get file type by link ----------
986			
987			var get_type = function( src ){
988				
989				if( src.match(/youtube\.com\/watch/i) || src.match(/youtu\.be/i) ){
990					return 'iframe';
991					
992				} else if( src.match(/vimeo\.com/i) ){
993					return 'iframe';
994					
995				} else if( src.match(/\biframe=true\b/i) ){
996					return 'ajax';
997					
998				} else if( src.match(/\bajax=true\b/i) ){
999					return 'ajax';
1000					
1001				} else if( src.substr(0,1) == '#' ){
1002					return 'inline';
1003					
1004				} else {
1005					return 'image';
1006					
1007				}
1008			};
1009			
1010			
1011			// set file type ----------
1012			
1013			var set_type = function(){
1014
1015				$( 'a[rel^="lightbox"]' ).each(function(){
1016					
1017					var el 		= $( this );
1018					var href 	= el.attr( 'href' );
1019					var rel 	= el.attr( 'rel' );
1020					
1021					if( href ){
1022						
1023						// gallery
1024						var gallery = is_gallery( rel );
1025						if( gallery ){
1026							el.attr( 'data-type', 'gallery' );
1027							set_gallery( gallery );
1028							return true;
1029						}
1030						
1031						el.attr( 'data-type', get_type( href ) );
1032					}
1033
1034				});
1035				
1036//				console.log( galleries );
1037				
1038			};
1039			
1040			
1041			// constructor ----------
1042			
1043			var constructor = function(){
1044				
1045				var attr = {
1046					autoFocusLast	: false,
1047					removalDelay	: 160,
1048					image			: {
1049						titleSrc	: function( item ){
1050							return ( lightbox_attr.title ) ? item.img.attr( 'alt' ) : false;
1051						}
1052					}
1053				};
1054
1055				// image
1056				
1057				$( 'a[rel^="lightbox"][data-type="image"]' ).magnificPopup({
1058					autoFocusLast	: attr.autoFocusLast,
1059					removalDelay	: attr.removalDelay,
1060					type			: 'image',
1061					image			: attr.image	
1062				});
1063				
1064				// iframe | video
1065				
1066				$( 'a[rel^="lightbox"][data-type="iframe"]' ).magnificPopup({
1067					autoFocusLast	: attr.autoFocusLast,
1068					removalDelay	: attr.removalDelay,
1069					type			: 'iframe'		
1070				});
1071				
1072				// inline
1073				
1074				$( 'a[rel^="lightbox"][data-type="inline"]' ).magnificPopup({
1075					autoFocusLast	: attr.autoFocusLast,
1076					type			: 'inline',
1077					midClick		: true,
1078					callbacks		: {
1079						open: function(){
1080							$( '.mfp-content' ).children().addClass( 'mfp-inline' );
1081						},
1082						beforeClose: function(){
1083							$( '.mfp-content' ).children().removeClass( 'mfp-inline' );
1084						}
1085					}
1086				});
1087				
1088				// gallery
1089				
1090				for( var i = 0, len = galleries.length; i < len; i++ ){
1091					
1092					var gallery = '[' + galleries[i] + ']';
1093					gallery = 'a[rel^="lightbox' + gallery +'"]';
1094				
1095					$( gallery ).magnificPopup({
1096						autoFocusLast	: attr.autoFocusLast,
1097						removalDelay	: attr.removalDelay,
1098						type			: 'image',	
1099						gallery			: {
1100							enabled		: true,
1101						}
1102					});
1103				}
1104				
1105			};
1106			
1107			
1108			// Visual Composer prettyPhoto | unbind ----------
1109			
1110			var unbindPretty = function(){
1111				
1112				if( lightbox_attr ){
1113					$( 'a[data-rel^="prettyPhoto"], a[rel^="lightbox"]' ).each( function(){
1114						$( this ).unbind( 'click.prettyphoto' );
1115					});
1116				}
1117				
1118			}
1119			
1120			
1121			// init ----------
1122			
1123			init();
1124			
1125			// onload ----------
1126			
1127			$( window ).on( 'load', unbindPretty );
1128				
1129		}
1130
1131		lightbox();
1132
1133		
1134		/* ---------------------------------------------------------------------------
1135		 * Menu | mfnMenu
1136		 * --------------------------------------------------------------------------- */
1137		
1138		function mainMenu(){
1139			
1140			var mm_mobile_init_W = mobile_init_W;
1141
1142			if( $( 'body' ).hasClass( 'header-simple' ) || $( '#Header_creative.dropdown' ).length ){
1143				mm_mobile_init_W = 9999;
1144			}
1145		
1146			$( '#menu > ul.menu' ).mfnMenu({
1147				addLast		: true,
1148				arrows		: true,
1149				mobileInit	: mm_mobile_init_W,
1150				responsive	: window.mfn.responsive
1151			});
1152			
1153			$( '#secondary-menu > ul.secondary-menu' ).mfnMenu({
1154				mobileInit	: mm_mobile_init_W,
1155				responsive	: window.mfn.responsive
1156			});
1157			
1158		}
1159	
1160		mainMenu();
1161		
1162		mfn_stickyH();
1163		mfn_sticky();
1164		mfn_mobile_sticky();
1165
1166		
1167		/* ---------------------------------------------------------------------------
1168		 * Menu | NOT One Page | .scroll item
1169		 * Works with .scroll class
1170		 * Since 4.8 replaced with: Page Options > One Page | function: onePageMenu()
1171		 * --------------------------------------------------------------------------- */
1172		
1173		function onePageScroll(){
1174			if( ! $('body').hasClass('one-page') ){
1175				var menu = $('#menu');
1176				
1177				if( menu.find('li.scroll').length > 1 ){
1178					menu.find('li.current-menu-item:not(:first)').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor');
1179					
1180					// menu item click
1181					menu.find('a').click(function(){
1182						$(this).closest('li').siblings('li').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor');
1183						$(this).closest('li').addClass('current-menu-item');
1184					});
1185				}
1186			}
1187		}
1188		onePageScroll();
1189
1190		
1191		/* ---------------------------------------------------------------------------
1192		 * Menu | One Page | Active on Scroll & Click
1193		 * --------------------------------------------------------------------------- */
1194		
1195		function onePageMenu(){
1196			if( $('body').hasClass('one-page') ){
1197				
1198				var menu = $('#menu');
1199
1200				
1201				// add attr [data-hash] & [data-id] ----------
1202				
1203				$('a[href]', menu).each(function(){	
1204
1205					var url = $(this).attr( 'href' );
1206					if( url && url.split('#')[1] ){
1207
1208						// data-hash
1209						var hash = '#' + url.split('#')[1];
1210						if( hash && $(hash).length ){				// check if element with specified ID exists
1211							$(this).attr( 'data-hash', hash );
1212							$(hash).attr( 'data-id', hash );
1213						}
1214						
1215						// Visual Composer
1216						var vcHash = '#' + url.split('#')[1];
1217						var vcClass = '.vc_row.' + url.split('#')[1];
1218						if( vcClass && $(vcClass).length ){			// check if element with specified Class exists
1219							$(this).attr( 'data-hash', vcHash );
1220							$(vcClass).attr( 'data-id', vcHash );
1221						}
1222						
1223					}
1224					
1225				});
1226				
1227
1228				// active ----------
1229				
1230				var hash;
1231				var activeSelector 	= '.menu > li.current-menu-item, .menu > li.current-menu-parent, .menu > li.current-menu-ancestor, .menu > li.current-page-ancestor, .menu > li.current_page_item, .menu > li.current_page_parent, .menu > li.current_page_ancestor';
1232				var activeClasses 	= 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor';
1233				
1234				if( $( activeSelector, menu ).length ){
1235
1236					// remove duplicated 
1237					$( activeSelector, menu )
1238						.not(':first').removeClass( activeClasses );
1239					
1240					// remove if 1st link to section & section is not visible
1241					hash = $( activeSelector, menu ).find('a[data-hash]').attr( 'data-hash' );
1242					
1243					if( hash ){
1244						hash = '[data-id="'+ hash +'"]';
1245						
1246						if( $(hash).length && $( hash ).visible( true ) ){
1247							// do nothing							
1248						} else {
1249							$( activeSelector, menu ).removeClass( 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor' )
1250								.closest('.menu > li').removeClass( 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor' );
1251						}
1252					} else {
1253						// do nothing
1254					}
1255					
1256				} else {
1257					
1258					// add to first if none is active
1259					var first = $( '.menu:first-child > li:first-child', menu );
1260					var firstA  = first.children('a');
1261					
1262					if( firstA.attr( 'data-hash' ) ){		
1263						hash = firstA.attr( 'data-hash' );
1264						hash = '[data-id="'+ hash +'"]';
1265						
1266						if( $(hash).length && ( $(hash).offset().top == adminBarH() ) ){
1267							first.addClass( 'current-menu-item' );
1268						}
1269					}
1270					
1271				}
1272
1273				
1274				// click ----------
1275				
1276				$('#menu a[data-hash]').click(function(e){
1277					e.preventDefault(); // only with: body.one-page
1278					
1279					// active
1280					
1281					menu.find('li').removeClass('current-menu-item');
1282					$(this)
1283						.closest('li').addClass('current-menu-item')
1284						.closest('.menu > li').addClass('current-menu-item');
1285	
1286					var hash = $(this).attr('data-hash');
1287					hash = '[data-id="'+ hash +'"]';
1288					
1289					// mobile - sticky header - close menu
1290					
1291					if( window.innerWidth < 768 ){
1292						$('.responsive-menu-toggle').removeClass('active');
1293						$('#Top_bar #menu').hide();
1294					}
1295					
1296					// offset
1297					
1298					var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight();
1299					var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight();
1300					
1301					var offset = headerFixedAbH + tabsHeaderH + adminBarH();
1302					
1303					// sticky height
1304					
1305					var stickyH = fixStickyHeaderH();
1306					
1307					// FIX | Header below | 1st section
1308					if( $( 'body' ).hasClass( 'header-below' ) && $( '#Content' ).length ){
1309						if( $( hash ).offset().top < ( $( '#Content' ).offset().top + 60 ) ){
1310							stickyH = -1;
1311						}	
1312					}
1313					
1314					// animate scroll
1315					
1316					$( 'html, body' ).animate({ 
1317						scrollTop: $( hash ).offset().top - offset - stickyH
1318					}, 500);
1319					
1320				});
1321				
1322			}
1323		}
1324		onePageMenu();
1325
1326		
1327		/* ---------------------------------------------------------------------------
1328		 * Header | Creative
1329		 * --------------------------------------------------------------------------- */
1330		
1331		var cHeader 	= 'body:not( .header-open ) #Header_creative';
1332		var cHeaderEl 	= $( cHeader );
1333		var cHeaderCurrnet;
1334		
1335		function creativeHeader(){
1336			
1337			$( '.creative-menu-toggle' ).click( function(e){
1338				e.preventDefault();
1339				
1340				cHeaderEl.addClass( 'active' );
1341				$( '.creative-menu-toggle, .creative-social', cHeaderEl ).fadeOut( 500 );
1342				
1343			});
1344		
1345		}
1346		creativeHeader();
1347		
1348		$(document).on( 'mouseenter', cHeader, function(){
1349			cHeaderCurrnet = 1;
1350		});
1351		
1352		$(document).on( 'mouseleave', cHeader, function(){
1353			cHeaderCurrnet = null;
1354		    setTimeout(function(){
1355		    	if ( ! cHeaderCurrnet ){
1356		    		
1357		    		cHeaderEl.removeClass( 'active' );
1358		    		$( '.creative-menu-toggle, .creative-social', cHeaderEl ).fadeIn( 500 );
1359		    		
1360		    	}
1361		    }, 1000);
1362		});
1363		
1364		
1365		/* ---------------------------------------------------------------------------
1366		 * Header | Search
1367		 * --------------------------------------------------------------------------- */
1368		
1369		$("#search_button:not(.has-input), #Top_bar .icon_close").click(function(e){
1370			e.preventDefault();
1371			$('#Top_bar .search_wrapper').fadeToggle()
1372				.find('.field').focus();			
1373		});
1374
1375		
1376		/* ---------------------------------------------------------------------------
1377		 * WPML | Language switcher in the WP Menu 
1378		 * --------------------------------------------------------------------------- */
1379		
1380		function mfn_wpml(){
1381			$('#menu .menu-item-language:not(.menu-item-language-current)').each(function(){
1382				var el = $(this).children('a');
1383				
1384				if( ! el.children('span:not(.icl_lang_sel_bracket)').length ){
1385					el.wrapInner('<span></span>');
1386				}
1387
1388			});
1389			
1390			$('#menu span.icl_lang_sel_bracket').each(function(){
1391				var el = $(this);
1392				el.replaceWith( el.html() );
1393			});
1394
1395		}
1396		mfn_wpml();
1397
1398		
1399		/* ---------------------------------------------------------------------------
1400		 * Breadcrumbs | Remove last item link
1401		 * --------------------------------------------------------------------------- */
1402		
1403		function breadcrumbsRemoveLastLink(){
1404			var el = $('.breadcrumbs.no-link').find('li').last();
1405			var text = el.text();
1406			el.html( text );
1407		}
1408		breadcrumbsRemoveLastLink();
1409        
1410        
1411        /* ---------------------------------------------------------------------------
1412         * Downcount
1413         * --------------------------------------------------------------------------- */
1414		
1415        $( '.downcount' ).each( function(){
1416        	var el = $(this);
1417        	el.downCount({
1418        		date	: el.attr('data-date'),
1419        		offset	: el.attr('data-offset')
1420        	});  
1421        }); 
1422        
1423        
1424        /* ---------------------------------------------------------------------------
1425         * Hover | on Touch | .tooltip, .hover_box
1426         * --------------------------------------------------------------------------- */
1427        
1428        $( '.tooltip, .hover_box' )
1429        .bind( 'touchstart', function(){
1430            $( this ).toggleClass( 'hover' );
1431        })
1432        .bind( 'touchend', function(){
1433            $( this ).removeClass( 'hover' );
1434        });
1435        
1436        
1437        /* ---------------------------------------------------------------------------
1438         * Popup | Contact Form | Button
1439         * --------------------------------------------------------------------------- */
1440        
1441        $("#popup_contact > a.button").click(function(e){
1442        	e.preventDefault();
1443        	$(this).parent().toggleClass('focus');
1444        });
1445			
1446
1447        /* ---------------------------------------------------------------------------
1448		 * Scroll | niceScroll
1449		 * --------------------------------------------------------------------------- */
1450		
1451        if( $('body').hasClass('nice-scroll-on') && window.innerWidth >= 768 && ! navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/))
1452        {
1453        	$('html').niceScroll({
1454        		autohidemode		: false,
1455        		cursorborder		: 0,
1456        		cursorborderradius	: 5,
1457        		cursorcolor			: '#222222',
1458        		cursorwidth			: 10,
1459        		horizrailenabled	: false,
1460        		mousescrollstep		: ( window.mfn.nicescroll ) ? window.mfn.nicescroll : 40,
1461        		scrollspeed			: 60
1462        	});
1463        	
1464        	$('body').removeClass('nice-scroll-on').addClass('nice-scroll');
1465        	niceScrollFix();
1466	    }
1467
1468        
1469        if( ('#Header_creative.scroll').length && window.innerWidth >= 1240 ){
1470        	$('#Header_creative.scroll').niceScroll({
1471        		autohidemode		: false,
1472        		cursorborder		: 0,
1473        		cursorborderradius	: 5,
1474        		cursorcolor			: '#222222',
1475        		cursorwidth			: 0,
1476        		horizrailenabled	: false,
1477        		mousescrollstep		: 40,
1478        		scrollspeed			: 60
1479        	});
1480        }
1481
1482        
1483		/* ---------------------------------------------------------------------------
1484		 * Black & White
1485		 * --------------------------------------------------------------------------- */
1486		
1487		function mfn_greyscale(){
1488	        $('.greyscale .image_wrapper > a, .greyscale .image_wrapper_tiles, .greyscale.portfolio-photo a, .greyscale .client_wrapper .gs-wrapper').has('img').BlackAndWhite({
1489	    		hoverEffect		: false,
1490	    		intensity		: 1			// opacity: 0, 0.1, ... 1
1491	    	});
1492		}
1493		mfn_greyscale();
1494		
1495
1496		/* ---------------------------------------------------------------------------
1497		 * Sliding Top
1498		 * --------------------------------------------------------------------------- */
1499		
1500		$( '.sliding-top-control' ).click(function(e){
1501			e.preventDefault();
1502			$('#Sliding-top .widgets_wrapper').slideToggle();
1503			$('#Sliding-top').toggleClass('active');
1504		});
1505
1506		
1507		/* ---------------------------------------------------------------------------
1508		 * Alert
1509		 * --------------------------------------------------------------------------- */
1510		
1511		$(this).on('click', '.alert .close', function(e) {
1512			e.preventDefault();
1513			$(this).closest('.alert').hide(300);
1514		});
1515		
1516		
1517		/* ---------------------------------------------------------------------------
1518		 * Button | mark buttons with icon & label
1519		 * --------------------------------------------------------------------------- */
1520		
1521		$( 'a.button_js' ).each(function(){
1522			var btn = $(this);
1523			if( btn.find('.button_icon').length && btn.find('.button_label').length ){
1524				btn.addClass('kill_the_icon');
1525			}
1526		});
1527		
1528		
1529		/* ---------------------------------------------------------------------------
1530		 * Navigation Arrows | Sticky
1531		 * --------------------------------------------------------------------------- */
1532		
1533		$('.fixed-nav').appendTo( 'body' );
1534		
1535		
1536		/* ---------------------------------------------------------------------------
1537		 * Feature List
1538		 * --------------------------------------------------------------------------- */
1539		
1540		$('.feature_list').each(function(){
1541			var col = $(this).attr('data-col') ? $(this).attr('data-col') : 4;
1542			$(this).find('li:nth-child('+ col +'n):not(:last-child)').after('<hr />');
1543		});
1544
1545		
1546		/* ---------------------------------------------------------------------------
1547		 * IE Fixes
1548		 * --------------------------------------------------------------------------- */
1549		
1550		function checkIE(){
1551			// IE 9
1552			var ua = window.navigator.userAgent;
1553	        var msie = ua.indexOf("MSIE ");
1554	        if( msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) == 9 ){
1555	        	$("body").addClass("ie");
1556			}
1557		}
1558		checkIE();
1559		
1560		
1561		/* ---------------------------------------------------------------------------
1562		 * Parallax
1563		 * --------------------------------------------------------------------------- */
1564		
1565		var ua = navigator.userAgent,
1566		isMobileWebkit = /WebKit/.test(ua) && /Mobile/.test(ua);
1567		
1568		if( ! isMobileWebkit && window.innerWidth >= 768 ){
1569			
1570			if( window.mfn.parallax == 'stellar' ){
1571				
1572				// Stellar
1573				$.stellar({
1574					horizontalScrolling	: false,
1575					responsive			: true
1576				});
1577		
1578			} else {
1579
1580				// Enllax
1581				$(window).enllax();
1582				
1583			}
1584
1585		} else {
1586			
1587			$('div[data-enllax-ratio], div[data-stellar-ratio]').css( 'background-attachment' , 'scroll' );
1588		
1589		}
1590		
1591		
1592		/* ---------------------------------------------------------------------------
1593		 * Load More | Ajax
1594		 * --------------------------------------------------------------------------- */
1595		
1596		$( '.pager_load_more' ).click(function(e){
1597			e.preventDefault();
1598			
1599			var el = $(this);
1600			var pager = el.closest( '.pager_lm' );
1601			var href = el.attr( 'href' );
1602			
1603			// index | for many items on the page
1604			var index = $( '.lm_wrapper' ).index(el.closest( '.isotope_wrapper' ).find( '.lm_wrapper' ));
1605
1606			el.fadeOut(50);
1607			pager.addClass( 'loading' );
1608			
1609			$.get( href, function( data ){
1610
1611				// content
1612				var content = $( '.lm_wrapper:eq('+ index +')', data ).wrapInner('').html();
1613
1614				if( $( '.lm_wrapper:eq('+ index +')' ).hasClass( 'isotope' ) ){
1615					// isotope
1616					$( '.lm_wrapper:eq('+ index +')' ).append( $(content) ).isotope( 'reloadItems' ).isotope({ sortBy: 'original-order' });
1617				} else {
1618					// default
1619					$( content ).hide().appendTo( '.lm_wrapper:eq('+ index +')' ).fadeIn( 1000 );
1620				}
1621
1622				// next page link
1623				href = $( '.lm_wrapper:eq('+ index +')', data ).next().find( '.pager_load_more' ).attr( 'href' );		
1624				pager.removeClass( 'loading' );					
1625				if( href ){
1626					el.fadeIn();
1627					el.attr( 'href', href );
1628				}
1629
1630				// refresh some staff -------------------------------
1631
1632				mfn_greyscale();
1633				
1634				mfn_jPlayer();
1635				
1636				lightbox();
1637
1638				// isotope fix: second resize
1639				
1640				$( '.lm_wrapper.isotope' ).imagesLoaded().progress( function() {
1641					$( '.lm_wrapper.isotope' ).isotope( 'layout' );
1642				});		
1643				
1644			});
1645
1646		});
1647
1648		
1649		/* ---------------------------------------------------------------------------
1650		 * Filters | Blog & Portfolio
1651		 * --------------------------------------------------------------------------- */
1652		
1653		$('.filters_buttons .open').click(function(e){
1654			e.preventDefault();
1655			var type = $(this).closest('li').attr('class');
1656			$('.filters_wrapper').show(200);
1657			$('.filters_wrapper ul.'+ type).show(200);
1658			$('.filters_wrapper ul:not(.'+ type +')').hide();
1659		});
1660		
1661		$('.filters_wrapper .close a').click(function(e){
1662			e.preventDefault();
1663			$('.filters_wrapper').hide(200);
1664		});
1665		
1666		
1667		/* ---------------------------------------------------------------------------
1668		 * Portfolio List | Next v / Prev ^ buttons
1669		 * --------------------------------------------------------------------------- */
1670		
1671		$('.portfolio_next_js').click(function(e){
1672			e.preventDefault();
1673			
1674			var item = $(this).closest('.portfolio-item').next();
1675			
1676			if( item.length ){
1677				$('html, body').animate({ 
1678					scrollTop: item.offset().top - fixStickyHeaderH()
1679				}, 500);
1680			}
1681		});
1682		
1683		$('.portfolio_prev_js').click(function(e){
1684			e.preventDefault();
1685			
1686			var item = $(this).closest('.portfolio-item').prev();
1687			
1688			if( item.length ){
1689				$('html, body').animate({ 
1690					scrollTop: item.offset().top - fixStickyHeaderH()
1691				}, 500);
1692			}
1693		});
1694
1695		
1696		/* ---------------------------------------------------------------------------
1697		 * Link | Smooth Scroll | .scroll
1698		 * --------------------------------------------------------------------------- */
1699		
1700		$( '.scroll > a, a.scroll' ).click( function(e){
1701			
1702			// prevent default if link directs to the current page
1703			
1704			var urlL = location.href.replace(/\/#.*|#.*/, '');
1705			var urlT = this.href.replace(/\/#.*|#.*/, '');
1706			if( urlL == urlT ) e.preventDefault();
1707
1708			var hash = this.hash;
1709			var tabsHeaderH = $( hash ).siblings( '.ui-tabs-nav' ).innerHeight();
1710			
1711			if( hash && $(hash).length ){
1712
1713				$( 'html, body' ).animate({ 
1714					scrollTop: $( hash ).offset().top - fixStickyHeaderH() - tabsHeaderH
1715				}, 500 );
1716			}
1717		});
1718		
1719		
1720		/* ---------------------------------------------------------------------------
1721		 * Tabs
1722		 * --------------------------------------------------------------------------- */
1723		
1724		$(".jq-tabs").tabs();
1725
1726		
1727		/* ---------------------------------------------------------------------------
1728		 * Accordion & FAQ
1729		 * --------------------------------------------------------------------------- */
1730		
1731		$('.mfn-acc').each(function(){
1732			var el = $(this);
1733			
1734			if( el.hasClass('openAll') ){
1735				// show all -----------
1736				
1737				el.find('.question')
1738					.addClass("active")
1739					.children(".answer")
1740						.show();
1741				
1742			} else {
1743				// show one -----------
1744				
1745				var active_tab = el.attr('data-active-tab');
1746				if( el.hasClass('open1st') ) active_tab = 1;
1747				
1748				if( active_tab ){
1749					el.find('.question').eq( active_tab - 1 )
1750						.addClass("active")
1751						.children(".answer")
1752							.show();
1753				}
1754				
1755			}	
1756		});
1757
1758		$(".mfn-acc .question > .title").click(function(){	
1759			
1760			if($(this).parent().hasClass("active")) {
1761				
1762				$(this).parent().removeClass("active").children(".answer").slideToggle(100);
1763				
1764			} else {
1765				
1766				if( ! $(this).closest('.mfn-acc').hasClass('toggle') ){
1767					$(this).parents(".mfn-acc").children().each(function() {
1768						if($(this).hasClass("active")) {
1769							$(this).removeClass("active").children(".answer").slideToggle(100);
1770						}
1771					});
1772				}
1773				$(this).parent().addClass("active");
1774				$(this).next(".answer").slideToggle(100);
1775				
1776			}
1777			
1778			setTimeout(function(){
1779				$(window).trigger('resize');
1780			},50);
1781			
1782		});
1783		
1784		
1785		/* ---------------------------------------------------------------------------
1786		 * Helper
1787		 * --------------------------------------------------------------------------- */
1788
1789		$('.helper .link.toggle').click( function(e){
1790			
1791			e.preventDefault();
1792			
1793			var el = $(this);
1794			var id = el.attr('data-rel');
1795			var parent = el.closest('.helper');
1796			
1797			if( el.hasClass('active') ){
1798				
1799				el.removeClass('active');
1800				parent.find('.helper_content > .item-' + id ).removeClass('active').slideUp(200);
1801
1802			} else {
1803				
1804				parent.find('.links > .link.active').removeClass('active');
1805				parent.find('.helper_content > .item.active').slideUp(200);
1806				
1807				el.addClass('active');
1808				parent.find('.helper_content > .item-' + id ).addClass('active').slideDown(200);
1809
1810			}
1811			
1812			setTimeout(function(){
1813				$(window).trigger('resize');
1814			},50);
1815			
1816		});
1817
1818		
1819		/* ---------------------------------------------------------------------------
1820		 * HTML5 Video | jPlayer
1821		 * --------------------------------------------------------------------------- */
1822		
1823		function mfn_jPlayer(){
1824			$('.mfn-jplayer').each(function(){
1825				var m4v = $(this).attr('data-m4v');
1826				var poster = $(this).attr('data-img');
1827				var swfPath = $(this).attr('data-swf');
1828				var cssSelectorAncestor = '#' + $(this).closest('.mfn-jcontainer').attr('id');
1829				
1830				$(this).jPlayer({
1831					ready	: function () {
1832						$(this).jPlayer('setMedia', {
1833							m4v		: m4v,
1834							poster	: poster
1835						});
1836					},
1837					play	: function () { // To avoid both jPlayers playing together.
1838						$(this).jPlayer('pauseOthers');
1839					},
1840					size: {
1841						cssClass	: 'jp-video-360p',
1842						width		: '100%',
1843						height		: '360px'
1844					},
1845					swfPath				: swfPath,
1846					supplied			: 'm4v',
1847					cssSelectorAncestor	: cssSelectorAncestor,
1848					wmode				: 'opaque'
1849				});
1850			});
1851		}
1852		mfn_jPlayer();
1853		
1854		
1855		/* ---------------------------------------------------------------------------
1856		 * Love
1857		 * --------------------------------------------------------------------------- */
1858		
1859		$('.mfn-love').click(function() {
1860			var el = $( this );
1861			if( el.hasClass( 'loved' ) ){
1862				return false;
1863			}
1864			el.addClass( 'loved' );
1865			
1866			var post = {
1867				action: 'mfn_love',
1868				post_id: el.attr( 'data-id' )
1869			};
1870			
1871			$.post( window.mfn_ajax, post, function( data ){
1872				el.find( '.label' ).html( data );
1873			});
1874
1875			return false;
1876		});	
1877		
1878		
1879		/* ---------------------------------------------------------------------------
1880		 * Go to top
1881		 * --------------------------------------------------------------------------- */
1882		
1883		$('#back_to_top').click(function(){
1884			$('body,html').animate({
1885				scrollTop: 0
1886			}, 500);
1887			return false;
1888		});		
1889		
1890		
1891		/* ---------------------------------------------------------------------------
1892		 * Section | Next v / Prev ^ arrows
1893		 * --------------------------------------------------------------------------- */	
1894		
1895		$('.section .section-nav').click(function(){
1896			var el = $(this);
1897			var section = el.closest('.section');
1898
1899			if( el.hasClass('prev') ){
1900				// Previous Section -------------
1901				if( section.prev().length ){	
1902					$('html, body').animate({
1903						scrollTop: section.prev().offset().top
1904					}, 500);
1905				}
1906			} else {
1907				// Next Section -----------------
1908				if( section.next().length ){	
1909					$('html, body').animate({
1910						scrollTop: section.next().offset().top
1911					}, 500);
1912				}			
1913			}
1914		});
1915		
1916		
1917		/* ---------------------------------------------------------------------------
1918		 * Intro | Scroll v arrow
1919		 * --------------------------------------------------------------------------- */
1920		
1921		$('#Intro .intro-next').click(function(){
1922			var intro = $(this).closest('#Intro');
1923			
1924			if( intro.next().length ){
1925				$('html, body').animate({ 
1926					scrollTop: intro.next().offset().top - fixStickyHeaderH() - adminBarH()
1927				}, 500);
1928			}			
1929		});
1930		
1931		
1932		/* ---------------------------------------------------------------------------
1933		 * Widget | Muffin Menu | Hover on click
1934		 * --------------------------------------------------------------------------- */
1935		
1936		$('.widget_mfn_menu ul.submenus-click').each(function(){
1937			var el = $(this);
1938			$( 'a', el ).click(function(e){
1939				var li = $(this).closest('li');
1940				
1941				if( li.hasClass('hover') || ! li.hasClass('menu-item-has-children') ){
1942					// link click
1943				} else {
1944					e.preventDefault();
1945					li.siblings('li').removeClass('hover')
1946						.find('li').removeClass('hover');
1947					$(this).closest('li').addClass('hover');
1948				}
1949				
1950			});
1951		});
1952		
1953		
1954		/* ---------------------------------------------------------------------------
1955		 * WooCommerce | Add to cart
1956		 * --------------------------------------------------------------------------- */
1957		
1958		function addToCart(){
1959			$('body').on('click', '.add_to_cart_button', function(){
1960				$(this)
1961					.closest('.product')
1962						.addClass('adding-to-cart')
1963						.removeClass('added-to-cart');
1964			});
1965
1966			$('body').bind('added_to_cart', function() {
1967				$('.adding-to-cart')
1968					.removeClass('adding-to-cart')
1969					.addClass('added-to-cart');
1970			});
1971		}
1972		addToCart();
1973		
1974		
1975		/* ---------------------------------------------------------------------------
1976		 * Ajax | Complete
1977		 * --------------------------------------------------------------------------- */
1978		
1979		$(document).ajaxComplete( function() {
1980
1981			setTimeout(function(){
1982				$(window).trigger('resize');
1983			},100);
1984			
1985		});
1986		
1987		
1988		/* ---------------------------------------------------------------------------
1989		 * Isotope
1990		 * --------------------------------------------------------------------------- */
1991		
1992		// Isotope | Fiters ----------
1993		
1994		function isotopeFilter( domEl, isoWrapper ){
1995			var filter = domEl.attr('data-rel');
1996			isoWrapper.isotope({ filter: filter });
1997		}
1998		
1999		// Isotope | Fiters | Click ----------
2000		
2001		$('.isotope-filters .filters_wrapper').find('li:not(.close) a').click(function(e){
2002			e.preventDefault();
2003
2004			var isoWrapper = $('.isotope');
2005			var filters 	= $(this).closest('.isotope-filters');
2006			var parent  	= filters.attr('data-parent');
2007			
2008			if( parent ){
2009				parent = filters.closest( '.' + parent );
2010				isoWrapper = parent.find('.isotope').first();
2011			}
2012			
2013			filters.find('li').removeClass('current-cat');
2014			$(this).closest('li').addClass('current-cat');
2015
2016			isotopeFilter( $(this), isoWrapper );
2017		});
2018
2019		
2020		// Isotope | Fiters | Reset ----------
2021		
2022		$('.isotope-filters .filters_buttons').find('li.reset a').click(function(e){
2023			e.preventDefault();
2024			
2025			$('.isotope-filters .filters_wrapper').find('li').removeClass('current-cat');
2026			isotopeFilter( $(this), $('.isotope') );
2027		});
2028
2029		
2030		
2031		/* --------------------------------------------------------------------------------------------------------------------------
2032		 * 
2033		 * $(window).resize | Debouncedresize
2034		 * 
2035		 * ----------------------------------------------------------------------------------------------------------------------- */
2036		
2037		
2038		$(window).bind("debouncedresize", function(){
2039			
2040			
2041			// Isotope | Relayout
2042			$('.masonry.isotope').isotope();
2043			$('.masonry.gallery').isotope( 'layout');
2044
2045			// Sliding Footer | Height
2046			mfn_footer();
2047			
2048			// Header Width
2049			mfn_header();
2050			
2051			// Sidebar Height
2052			mfn_sidebar();
2053			
2054			// Full Screen Section
2055			mfn_sectionH();
2056			
2057			// Full Screen Intro
2058			mfn_introH();
2059			
2060			// niceScroll | Padding right fix for short content
2061			niceScrollFix();
2062			
2063			// Zoom Box | Vertical Align
2064			zoomBoxVerticalAlign();
2065			
2066			// Equal | Height
2067			mfn_equalH_wrap();
2068			mfn_equalH();
2069			
2070			
2071		});
2072		
2073		
2074		
2075		/* --------------------------------------------------------------------------------------------------------------------------
2076		 * 
2077		 * document.ready | Init
2078		 * 
2079		 * ----------------------------------------------------------------------------------------------------------------------- */
2080		
2081		
2082		mfnSliderOffer();
2083		mfnSliderOfferThumb();
2084		mfnSliderBlog();
2085		mfnSliderClients();	
2086		mfnSliderShop();
2087		
2088		sliderPortfolio();
2089		sliderSlider();
2090		sliderTestimonials();
2091		
2092		// Sidebar | Height
2093		mfn_sidebar();
2094		
2095		// Sliding Footer | Height
2096		mfn_footer();
2097		
2098		// Header | Width
2099		mfn_header();
2100
2101		// Full Screen Section
2102		mfn_sectionH();
2103		// Navigation | Hash
2104		hashNav();
2105		
2106		// Full Screen Intro
2107		mfn_introH();
2108
2109		// Equal | Height
2110		mfn_equalH_wrap();
2111		mfn_equalH();
2112	});
2113	
2114
2115	
2116	/* --------------------------------------------------------------------------------------------------------------------------
2117	 * 
2118	 * $(window).scroll
2119	 * 
2120	 * ----------------------------------------------------------------------------------------------------------------------- */
2121	
2122	
2123	$(window).scroll(function(){
2124		
2125		
2126		// Header | Sticky
2127		mfn_sticky();
2128		
2129		// Back to top | Sticky
2130		backToTopSticky();
2131		
2132		// One Page | Scroll | Active Section
2133		onePageActive();
2134		
2135		
2136	});
2137	
2138	
2139	
2140	/* --------------------------------------------------------------------------------------------------------------------------
2141	 * 
2142	 * $(window).load
2143	 * 
2144	 * ----------------------------------------------------------------------------------------------------------------------- */
2145	
2146	
2147	$(window).load(function(){
2148
2149		
2150		/* ---------------------------------------------------------------------------
2151		 * Retina Logo
2152		 * --------------------------------------------------------------------------- */
2153		
2154		function retinaLogo(){
2155			if( window.devicePixelRatio > 1 ){
2156				
2157				var el 		= '';
2158				var src 	= '';
2159				var height 	= '';
2160				
2161				var parent 	= $( '#Top_bar #logo' );
2162				var parentH	= parent.data( 'height' );
2163				
2164				var maxH	= {
2165					sticky : {
2166						init 			: 35,
2167						no_padding		: 60,
2168						overflow 		: 110
2169					},
2170					mobile : {
2171						mini 			: 50,
2172						mini_no_padding	: 60
2173					},
2174					mobile_sticky : {
2175						init 			: 50,
2176						no_padding		: 60,
2177						overflow 		: 80
2178					}
2179				};
2180
2181				$( '#Top_bar #logo img' ).each( function( index ){
2182					
2183					el 		= $( this );
2184					src 	= el.data( 'retina' );
2185					height 	= el.height();
2186
2187					
2188					// main -----
2189					
2190					if( el.hasClass( 'logo-main' ) ){
2191						
2192						if( $( 'body' ).hasClass( 'logo-overflow' ) ){
2193							
2194							// do nothing
2195							
2196						} else if( height > parentH ){
2197							
2198							height = parentH;
2199							
2200						}
2201						
2202					}
2203					
2204					// sticky -----
2205					
2206					if( el.hasClass( 'logo-sticky' ) ){
2207						
2208						if( $( 'body' ).hasClass( 'logo-overflow' ) ){
2209							
2210							if( height > maxH.sticky.overflow ){
2211								height = maxH.sticky.overflow;
2212							}
2213								
2214						} else if( $( 'body' ).hasClass( 'logo-no-sticky-padding' ) ){
2215							
2216							if( height > maxH.sticky.no_padding ){
2217								height = maxH.sticky.no_padding;
2218							}
2219								
2220						} else if( height > maxH.sticky.init ){
2221							
2222							height = maxH.sticky.init;
2223							
2224						}
2225						
2226					}
2227					
2228					// mobile -----
2229					
2230					if( el.hasClass( 'logo-mobile' ) ){
2231						
2232						if( $( 'body' ).hasClass( 'mobile-header-mini' ) ){
2233							
2234							if( parent.data( 'padding' ) > 0 ){
2235								
2236								if( height > maxH.mobile.mini ){
2237									height = maxH.mobile.mini;
2238								}
2239								
2240							} else {
2241								
2242								if( height > maxH.mobile.mini_no_padding ){
2243									height = maxH.mobile.mini_no_padding;
2244								}
2245								
2246							}
2247								
2248						}
2249						
2250					}
2251					
2252					// mobile-sticky -----
2253					
2254					if( el.hasClass( 'logo-mobile-sticky' ) ){
2255						
2256						if( $( 'body' ).hasClass( 'logo-no-sticky-padding' ) ){
2257							
2258							if( height > maxH.mobile_sticky.no_padding ){
2259								height = maxH.mobile_sticky.no_padding;
2260							}
2261								
2262						} else if( height > maxH.mobile_sticky.init ){
2263							height = maxH.mobile_sticky.init;
2264						}
2265						
2266					}
2267
2268					
2269					// SET
2270					
2271					if( src ){
2272						el.parent().addClass( 'retina' );
2273						el.attr( 'src', src ).css( 'max-height', height + 'px' );												
2274					}
2275					
2276				});
2277				
2278			}
2279		}
2280		retinaLogo();
2281
2282		
2283		/* ---------------------------------------------------------------------------
2284		 * Isotope
2285		 * --------------------------------------------------------------------------- */
2286		
2287		// Portfolio - Isotope
2288		$('.portfolio_wrapper .isotope:not( .masonry-flat, .masonry-hover, .masonry-minimal )').isotope({
2289			itemSelector	: '.portfolio-item',
2290			layoutMode		: 'fitRows',
2291			isOriginLeft	: rtl ? false : true
2292		});
2293		
2294		// Portfolio - Masonry Flat
2295		$('.portfolio_wrapper .masonry-flat').isotope({
2296			itemSelector	: '.portfolio-item',
2297			percentPosition	: true,
2298			masonry			: {
2299				columnWidth: 1
2300		    },
2301		    isOriginLeft	: rtl ? false : true
2302		});
2303
2304		// Blog & Portfolio - Masonry
2305		$('.isotope.masonry, .isotope.masonry-hover, .isotope.masonry-minimal').isotope({
2306			itemSelector	: '.isotope-item',
2307			layoutMode		: 'masonry',
2308			isOriginLeft	: rtl ? false : true
2309		});
2310		
2311		// Portfolio | Active Category
2312		function portfolioActive(){
2313			var el 		= $('.isotope-filters .filters_wrapper');
2314			var active 	= el.attr('data-cat');
2315			
2316			if( active ){
2317				el.find('li.'+active).addClass('current-cat');
2318				$('.isotope').isotope({ filter: '.category-' + active });
2319			}
2320		}
2321		portfolioActive();
2322
2323		
2324		/* ---------------------------------------------------------------------------
2325		 * Chart
2326		 * --------------------------------------------------------------------------- */
2327		
2328		$( '.chart' ).waypoint({
2329			
2330			offset		: '100%',
2331			triggerOnce	: true,
2332			handler		: function(){
2333
2334				var el 		= $( this.element ).length ? $( this.element ) : $( this );
2335				var lineW 	= simple ? 4 : 8;
2336				
2337				el.easyPieChart({
2338					animate		: 1000,
2339					lineCap		: 'circle',
2340					lineWidth	: lineW,
2341					size		: 140,
2342					scaleColor	: false,
2343					trackColor	: '#f8f8f8'
2344				});
2345				
2346				if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){
2347					this.destroy();
2348				}
2349			}
2350		});
2351		
2352		
2353		/* ---------------------------------------------------------------------------
2354		 * Skills
2355		 * --------------------------------------------------------------------------- */
2356
2357		$( '.bars_list' ).waypoint({
2358			
2359			offset		: '100%',
2360			triggerOnce	: true,
2361			handler		: function(){
2362				
2363				var el = $( this.element ).length ? $( this.element ) : $( this );
2364				
2365				el.addClass( 'hover' );
2366				
2367				if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){
2368					this.destroy();
2369				}
2370			}
2371		});
2372		
2373		
2374		/* ---------------------------------------------------------------------------
2375		 * Progress Icons
2376		 * --------------------------------------------------------------------------- */
2377
2378		$('.progress_icons').waypoint({
2379			
2380			offset		: '100%',
2381			triggerOnce	: true,
2382			handler		: function(){
2383				
2384				var el 		= $( this.element ).length ? $( this.element ) : $( this );
2385				var active 	= el.attr( 'data-active' );
2386				var color 	= el.attr( 'data-color' );
2387				var icon 	= el.find( '.progress_icon' );
2388				var timeout	= 200;		// timeout in milliseconds
2389				
2390				icon.each( function(i){
2391					if( i < active ){
2392						var time = ( i+1 ) * timeout; 
2393						setTimeout( function(){
2394							$( icon[i] )
2395								.addClass( 'themebg' )
2396								.css( 'background-color', color );
2397						},time );	
2398					}
2399				});
2400				
2401				if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){
2402					this.destroy();
2403				}
2404			}
2405		});
2406		
2407		
2408		/* ---------------------------------------------------------------------------
2409		 * Animate Math | Counter, Quick Fact, etc.
2410		 * --------------------------------------------------------------------------- */
2411
2412		$('.animate-math .number').waypoint({
2413			
2414			offset		: '100%',
2415			triggerOnce	: true,
2416			handler		: function(){
2417				
2418				var el			= $( this.element ).length ? $( this.element ) : $( this );
2419				var duration	= Math.floor( ( Math.random() * 1000 ) + 1000 );
2420				var to			= el.attr( 'data-to' );
2421
2422				$({ property:0 }).animate({ property:to }, {
2423					duration	: duration,
2424					easing		:'linear',
2425					step		: function() {
2426						el.text( Math.floor( this.property ) );
2427					},
2428					complete	: function() {
2429						el.text( this.property );
2430					}
2431				});
2432
2433				if( typeof this.destroy !== 'undefined' && $.isFunction( this.destroy ) ){
2434					this.destroy();
2435				}
2436			}
2437		});
2438		
2439		
2440		/* ---------------------------------------------------------------------------
2441		 * Before After | TwentyTwenty
2442		 * --------------------------------------------------------------------------- */
2443		
2444		$('.before_after.twentytwenty-container').twentytwenty();	
2445		
2446		
2447		/* --------------------------------------------------------------------------------------------------------------------------
2448		 * 
2449		 * window.load | Init
2450		 * 
2451		 * ----------------------------------------------------------------------------------------------------------------------- */
2452		
2453		// Full Screen Section
2454		mfn_sectionH();
2455		
2456		// Navigation | Hash
2457		hashNav();
2458		
2459		// Full Screen Intro
2460		mfn_introH();
2461		
2462		// FIX | Revolution Slider Width OnLoad
2463		$(window).trigger( 'resize' );
2464
2465		// Sidebar | Height
2466		setTimeout(function(){
2467			mfn_sidebar();
2468		},10);
2469	});
2470	
2471
2472	
2473	/* --------------------------------------------------------------------------------------------------------------------------
2474	 * 
2475	 * $(document).mouseup
2476	 * 
2477	 * ----------------------------------------------------------------------------------------------------------------------- */
2478	
2479	
2480	$(document).mouseup(function(e){
2481		
2482		
2483		// Widget | Muffin Menu | Hover on click
2484		if( $(".widget_mfn_menu ul.submenus-click").length ){
2485			if( $(".widget_mfn_menu ul.submenus-click").has(e.target).length === 0 ){
2486				$('.widget_mfn_menu ul.submenus-click li').removeClass('hover');
2487			}
2488		}
2489		
2490		
2491	});
2492	
2493	
2494	
2495	/* --------------------------------------------------------------------------------------------------------------------------
2496	 * 
2497	 * Sliders configuration
2498	 * 
2499	 * ----------------------------------------------------------------------------------------------------------------------- */
2500	
2501	
2502	// Slick Slider | Auto responsive -----------------------------------------
2503	
2504	function slickAutoResponsive( slider, max, size ){
2505		
2506		if( ! max ) max = 5;
2507		if( ! size ) size = 380;
2508
2509		var width = slider.width();
2510		var count = Math.ceil( width / size );
2511		
2512		if( count < 1 ) count = 1;
2513		if( count > max ) count = max;
2514
2515		return count;
2516	}
2517
2518
2519	// --- Offer Thumb -----------------------------------------------------------------
2520
2521	function mfnSliderOfferThumb(){	
2522		
2523		var pager = function( el, i ){
2524	        var img = $( el.$slides[i] ).children( '.thumbnail' ).html();
2525	        return '<a>'+ img +'</a>';
2526	    };
2527		
2528		$('.offer_thumb_ul').each(function(){
2529			
2530			var slider = $(this);
2531			
2532			slider.slick({
2533				cssEase			: 'ease-out',
2534				arrows			: false,
2535				dots			: true,
2536				infinite		: true,			
2537				touchThreshold	: 10,
2538				speed			: 300,
2539
2540				adaptiveHeight	: true,				
2541				appendDots		: slider.siblings( '.slider_pagination' ),
2542				customPaging 	: pager,
2543
2544				rtl				: rtl ? true : false,
2545				autoplay		: window.mfn_sliders.offer ? true : false,
2546				autoplaySpeed	: window.mfn_sliders.offer ? window.mfn_sliders.offer : 5000,
2547
2548				slidesToShow	: 1,
2549				slidesToScroll	: 1
2550			});
2551
2552		});
2553	}
2554	
2555	
2556	// --- Offer -----------------------------------------------------------------
2557
2558	function mfnSliderOffer(){	
2559		$('.offer_ul').each( function(){
2560			
2561			var slider = $(this);
2562			
2563			slider.slick({
2564				cssEase			: 'ease-out',
2565				dots			: false,
2566				infinite		: true,			
2567				touchThreshold	: 10,
2568				speed			: 300,
2569				
2570				prevArrow		: '<a class="button button_large button_js slider_prev" href="#"><span class="button_icon"><i class="icon-up-open-big"></i></span></a>',
2571				nextArrow		: '<a class="button button_large button_js slider_next" href="#"><span class="button_icon"><i class="icon-down-open-big"></i></span></a>',
2572				
2573				adaptiveHeight	: true,
2574				//customPaging 	: pager,
2575
2576				rtl				: rtl ? true : false,
2577				autoplay		: window.mfn_sliders.offer ? true : false,
2578				autoplaySpeed	: window.mfn_sliders.offer ? window.mfn_sliders.offer : 5000,
2579
2580				slidesToShow	: 1,
2581				slidesToScroll	: 1
2582			});
2583			
2584			// Pagination | Show (css)
2585			slider.siblings('.slider_pagination').addClass('show');
2586			
2587			// Pager | Set slide number after change
2588			slider.on( 'afterChange', function( event, slick, currentSlide, nextSlide ){
2589				slider.siblings('.slider_pagination').find('.current').text( currentSlide + 1 );
2590			});
2591
2592		});
2593	}
2594	
2595
2596	// --- Shop ------------------------------------------------------------------
2597
2598	function mfnSliderShop(){	
2599		
2600		var pager = function( el, i ){
2601	        return '<a>'+ i +'</a>';
2602	    };
2603	    
2604		$('.shop_slider_ul').each(function(){
2605			
2606			var slider = $(this);
2607
2608			slider.slick({
2609				cssEase			: 'ease-out',
2610				dots			: true,
2611				infinite		: true,			
2612				touchThreshold	: 10,
2613				speed			: 300,
2614				
2615				prevArrow		: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2616				nextArrow		: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2617				appendArrows	: slider.siblings( '.blog_slider_header' ),
2618				
2619				appendDots		: slider.siblings( '.slider_pager' ),
2620				customPaging 	: pager,
2621
2622				rtl				: rtl ? true : false,
2623				autoplay		: window.mfn_sliders.shop ? true : false,
2624				autoplaySpeed	: window.mfn_sliders.shop ? window.mfn_sliders.shop : 5000,
2625
2626				slidesToShow	: slickAutoResponsive( slider, 4 ),
2627				slidesToScroll	: slickAutoResponsive( slider, 4 )
2628			});
2629
2630			// Bind | debouncedresize
2631			$(window).bind( 'debouncedresize', function(){
2632				slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, 4 ), false );
2633				slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, 4 ), true );
2634			});
2635
2636		});
2637	}
2638	
2639	
2640	// --- Blog ------------------------------------------------------------------
2641
2642	function mfnSliderBlog(){
2643		
2644		var pager = function( el, i ){
2645	        return '<a>'+ i +'</a>';
2646	    };
2647	    
2648		$('.blog_slider_ul').each(function(){
2649			
2650			var slider = $(this);
2651			var slidesToShow = 4;
2652			
2653			var count = slider.closest( '.blog_slider' ).data( 'count' );	
2654			if( slidesToShow > count ){
2655				slidesToShow = count;
2656				if( slidesToShow < 1 ){
2657					slidesToShow = 1;
2658				}
2659			}
2660			
2661			slider.slick({
2662				cssEase			: 'ease-out',
2663				dots			: true,
2664				infinite		: true,			
2665				touchThreshold	: 10,
2666				speed			: 300,
2667				
2668				prevArrow		: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2669				nextArrow		: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2670				appendArrows	: slider.siblings( '.blog_slider_header' ),
2671				
2672				appendDots		: slider.siblings( '.slider_pager' ),
2673				customPaging 	: pager,
2674
2675				rtl				: rtl ? true : false,
2676				autoplay		: window.mfn_sliders.blog ? true : false,
2677				autoplaySpeed	: window.mfn_sliders.blog ? window.mfn_sliders.blog : 5000,
2678
2679				slidesToShow	: slickAutoResponsive( slider, slidesToShow ),
2680				slidesToScroll	: slickAutoResponsive( slider, slidesToShow )
2681			});
2682
2683			// Bind | debouncedresize
2684			$(window).bind( 'debouncedresize', function(){
2685				slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, slidesToShow ), false );
2686				slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, slidesToShow ), true );
2687			});
2688
2689		});
2690	}
2691	
2692	
2693	// --- Clients ------------------------------------------------------------------
2694
2695	function mfnSliderClients(){	
2696		$('.clients_slider_ul').each(function(){
2697			
2698			var slider = $(this);
2699
2700			slider.slick({
2701				cssEase			: 'ease-out',
2702				dots			: false,
2703				infinite		: true,			
2704				touchThreshold	: 10,
2705				speed			: 300,
2706				
2707				prevArrow		: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2708				nextArrow		: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2709				appendArrows	: slider.siblings( '.clients_slider_header' ),
2710
2711				rtl				: rtl ? true : false,
2712				autoplay		: window.mfn_sliders.clients ? true : false,
2713				autoplaySpeed	: window.mfn_sliders.clients ? window.mfn_sliders.clients : 5000,
2714
2715				slidesToShow	: slickAutoResponsive( slider, 4 ),
2716				slidesToScroll	: slickAutoResponsive( slider, 4 )
2717			});
2718
2719			// Bind | debouncedresize
2720			$(window).bind( 'debouncedresize', function(){
2721				slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, 4 ), false );
2722				slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, 4 ), true );
2723			});
2724
2725		});
2726	}
2727	
2728	
2729	// --- Portfolio -------------------------------------------------------------
2730
2731	function sliderPortfolio(){
2732		
2733		$('.portfolio_slider_ul').each(function(){
2734			
2735			var slider = $(this);
2736			var size = 380;
2737			var scroll = 5;
2738			
2739			if( slider.closest( '.portfolio_slider' ).data( 'size' ) ){
2740				size = slider.closest( '.portfolio_slider' ).data( 'size' );
2741			}
2742			
2743			if( slider.closest( '.portfolio_slider' ).data( 'size' ) ){
2744				scroll = slider.closest( '.portfolio_slider' ).data( 'scroll' );
2745			}
2746
2747			slider.slick({
2748				cssEase			: 'ease-out',
2749				dots			: false,
2750				infinite		: true,			
2751				touchThreshold	: 10,
2752				speed			: 300,
2753				
2754				prevArrow		: '<a class="slider_nav slider_prev themebg" href="#"><i class="icon-left-open-big"></i></a>',
2755				nextArrow		: '<a class="slider_nav slider_next themebg" href="#"><i class="icon-right-open-big"></i></a>',
2756
2757				rtl				: rtl ? true : false,
2758				autoplay		: window.mfn_sliders.portfolio ? true : false,
2759				autoplaySpeed	: window.mfn_sliders.portfolio ? window.mfn_sliders.portfolio : 5000,
2760
2761				slidesToShow	: slickAutoResponsive( slider, 5, size ),
2762				slidesToScroll	: slickAutoResponsive( slider, scroll, size )
2763			});
2764
2765			// Bind | debouncedresize
2766			$(window).bind( 'debouncedresize', function(){
2767				slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider, 5, size ), false );
2768				slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider, scroll, size ), true );
2769			});
2770	
2771		});
2772	}
2773	
2774	
2775	// --- Slider ----------------------------------------------------------------
2776	
2777	function sliderSlider(){
2778		
2779		var pager = function( el, i ){
2780	        return '<a>'+ i +'</a>';
2781	    };
2782	    
2783		$('.content_slider_ul').each(function(){
2784
2785			var slider 		= $(this);	
2786			var count 		= 1;
2787			var centerMode	= false;
2788			
2789			if( slider.closest( '.content_slider' ).hasClass( 'carousel' ) ){
2790				count = slickAutoResponsive( slider );
2791				
2792				$(window).bind( 'debouncedresize', function(){
2793					slider.slick( 'slickSetOption', 'slidesToShow', slickAutoResponsive( slider ), false );
2794					slider.slick( 'slickSetOption', 'slidesToScroll', slickAutoResponsive( slider ), true );
2795				});
2796			}
2797			
2798			if( slider.closest( '.content_slider' ).hasClass( 'center' ) ){
2799				centerMode = true;
2800			}			
2801
2802			slider.slick({
2803				cssEase			: 'cubic-bezier(.4,0,.2,1)',
2804				dots			: true,
2805				infinite		: true,			
2806				touchThreshold	: 10,
2807				speed			: 300,
2808				
2809				centerMode		: centerMode,
2810				centerPadding	: '20%',
2811				
2812				prevArrow		: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2813				nextArrow		: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2814
2815				adaptiveHeight	: true,	
2816				appendDots		: slider.siblings( '.slider_pager' ),
2817				customPaging 	: pager,
2818				
2819				rtl				: rtl ? true : false,
2820				autoplay		: window.mfn_sliders.slider ? true : false,
2821				autoplaySpeed	: window.mfn_sliders.slider ? window.mfn_sliders.slider : 5000,
2822						
2823				slidesToShow	: count,
2824				slidesToScroll	: count
2825			});
2826			
2827		});
2828	}
2829	
2830	
2831	// --- Testimonials ----------------------------------------------------------------
2832	
2833	function sliderTestimonials(){	
2834		
2835		var pager = function( el, i ){
2836	        var img = $( el.$slides[i] ).find('.single-photo-img').html();
2837	        return '<a>'+ img +'</a>';
2838	    };
2839		
2840		$('.testimonials_slider_ul').each(function(){
2841			
2842			var slider = $(this);
2843			
2844			slider.slick({
2845				cssEase			: 'ease-out',
2846				dots			: true,
2847				infinite		: true,			
2848				touchThreshold	: 10,
2849				speed			: 300,
2850				
2851				prevArrow		: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>',
2852				nextArrow		: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>',
2853				
2854				adaptiveHeight	: true,				
2855				appendDots		: slider.siblings( '.slider_pager' ),
2856				customPaging 	: pager,
2857
2858				rtl				: rtl ? true : false,
2859				autoplay		: window.mfn_sliders.testimonials ? true : false,
2860				autoplaySpeed	: window.mfn_sliders.testimonials ? window.mfn_sliders.testimonials : 5000,
2861
2862				slidesToShow	: 1,
2863				slidesToScroll	: 1
2864			});
2865			
2866		});
2867	}
2868	
2869
2870})(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.