PageSourceSearch

https://mpatino.com/wp-content/themes/jupiter/assets/js/components-full.6.1.3.js?ver=1637009521

js mpatino.com collected 2026-10-05 17:58:02 UTC 77,821 bytes, 2,481 lines download raw bytes

1(function($) {
2    'use strict';
3
4    function mk_animated_cols() {
5        function equalheight (container){
6            var currentTallest = 0,
7                 currentRowStart = 0,
8                 rowDivs = new Array(),
9                 $el,
10                 topPosition = 0;
11             $(container).each(function() {
12
13               $el = $(this);
14               $($el).height('auto');
15               topPosition = $el.position().top;
16
17               if (currentRowStart != topPosition) {
18                 for (var currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
19                   rowDivs[currentDiv].height(currentTallest);
20                 }
21                 rowDivs.length = 0; // empty the array
22                 currentRowStart = topPosition;
23                 currentTallest = $el.height();
24                 rowDivs.push($el);
25               } else {
26                 rowDivs.push($el);
27                 currentTallest = (currentTallest < $el.height()) ? ($el.height()) : (currentTallest);
28              }
29               for (currentDiv = 0 ; currentDiv < rowDivs.length ; currentDiv++) {
30                 rowDivs[currentDiv].height(currentTallest);
31               }
32
33             });
34
35            // console.log('recalc' + container + ' ' + currentTallest);
36
37            return currentTallest;
38        }
39
40
41        function prepareCols(el) {
42            var $this = el.parent().parent().find('.mk-animated-columns');
43
44            var iconHeight  = equalheight('.vc_row .animated-column-icon, .animated-column-holder .mk-svg-icon'),
45                titleHeight = equalheight('.vc_row .animated-column-title'),
46                descHeight  = equalheight('.vc_row .animated-column-desc'),
47                btnHeight   = $this.find('.animated-column-btn').innerHeight();
48
49            if ($this.hasClass('full-style')) {
50                $this.find('.animated-column-item').each(function() {
51                    var $this = $(this),
52                        contentHeight = (iconHeight + 30) + (titleHeight + 10) + (descHeight + 70) + 34;
53                    /*
54                     * Fix AM-2418.
55                     *
56                     * Column height setting of VC Animated Column doesn't work when Animated Column
57                     * content is higher than the setting. So, check column height setting first.
58                     * - If the column height setting < Animated Column height, update the column
59                     *   height based on column height setting.
60                     */
61                    var $columnHeight = contentHeight * 1.5 + 50;
62                    var $minHeight = parseInt( $this.css( 'min-height' ), 10 );
63                    if ( ! isNaN( $minHeight ) ) {
64                        if ( $minHeight < $columnHeight ) {
65                            $columnHeight = $minHeight;
66                        }
67                    }
68
69                    $this.height( $columnHeight );
70
71                    var $box_height = $this.outerHeight(true),
72                        $icon_height = $this.find('.animated-column-icon, .animated-column-holder .mk-svg-icon').height();
73
74                    $this.find('.animated-column-holder').css({
75                        'paddingTop': $box_height / 2 - $icon_height
76                    });
77
78
79                    $this.animate({opacity:1}, 300);
80                });
81            } else {
82                $this.find('.animated-column-item').each(function() {
83                    var $this = $(this),
84                        halfHeight = $this.height() / 2,
85                        halfIconHeight = $this.find('.animated-column-icon, .animated-column-holder .mk-svg-icon').height()/2,
86                        halfTitleHeight = $this.find('.animated-column-simple-title').height()/2;
87
88                    $this.find('.animated-column-holder').css({
89                        'paddingTop': halfHeight - halfIconHeight
90                    });
91
92                    $this.find('.animated-column-title').css({
93                        'paddingTop': halfHeight - halfTitleHeight
94                    });
95
96                    $this.animate({
97                        opacity:1
98                    }, 300);
99
100                });
101            }
102        }
103
104        $('.mk-animated-columns').each(function() {
105            var that = this;
106            MK.core.loadDependencies([ MK.core.path.plugins + 'tweenmax.js' ], function() {
107                var $this = $(that),
108                    $parent = $this.parent().parent(),
109                    $columns = $parent.find('.column_container'),
110                    index = $columns.index($this.parent());
111                    // really bad that we cannot read it before bootstrap - needs full shortcode refactor
112
113                if($this.hasClass('full-style')) {
114                    $this.find('.animated-column-item').hover(
115                    function() {
116                        TweenLite.to($(this).find(".animated-column-holder"), 0.5, {
117                            top: '-15%',
118                            ease: Back.easeOut
119                        });
120                        TweenLite.to($(this).find(".animated-column-desc"), 0.5, {
121                            top: '50%',
122                            ease: Expo.easeOut
123                        }, 0.4);
124                        TweenLite.to($(this).find(".animated-column-btn"), 0.3, {
125                            top: '50%',
126                            ease: Expo.easeOut
127                        }, 0.6);
128                    },
129                    function() {
130
131                        TweenLite.to($(this).find(".animated-column-holder"), 0.5, {
132                            top: '0%',
133                            ease: Back.easeOut, easeParams:[3]
134                        });
135                        TweenLite.to($(this).find(".animated-column-desc"), 0.5, {
136                            top: '100%',
137                            ease: Back.easeOut
138                        }, 0.4);
139                        TweenLite.to($(this).find(".animated-column-btn"), 0.5, {
140                            top: '100%',
141                            ease: Back.easeOut
142                        }, 0.2);
143                    });
144                }
145
146                if($this.hasClass('simple-style')) {
147                    $this.find('.animated-column-item').hover(
148                    function() {
149                        TweenLite.to($(this).find(".animated-column-holder"), 0.7, {
150                            top: '100%',
151                            ease: Expo.easeOut
152                        });
153                        TweenLite.to($(this).find(".animated-column-title"), 0.7, {
154                            top: '0%',
155                            ease: Back.easeOut
156                        }, 0.2);
157                    },
158                    function() {
159                        TweenLite.to($(this).find(".animated-column-holder"), 0.7, {
160                            top: '0%',
161                            ease: Expo.easeOut
162                        });
163                        TweenLite.to($(this).find(".animated-column-title"), 0.7, {
164                            top: '-100%',
165                            ease: Back.easeOut
166                        }, 0.2);
167                    });
168                }
169
170                if($columns.length === index + 1) {
171                    prepareCols($this);
172                    $(window).on("resize", function() {
173                            setTimeout(prepareCols($this), 1000);
174                    });
175                }
176
177                MK.utils.eventManager.subscribe('iconsInsert', function() {
178                    prepareCols($this);
179                });
180            });
181
182        });
183    }
184
185    $(window).on('load vc_reload', mk_animated_cols);
186
187}(jQuery));
188(function($) {
189    'use strict';
190
191    var _toBuild = [];
192
193    MK.component.AdvancedGMaps = function(el) {
194        var $this = $(el),
195            container = document.getElementById( 'mk-theme-container' ),
196            data = $this.data( 'advancedgmaps-config' ),
197            apikey = data.options.apikey ? ('key='+data.options.apikey+'&') : false,
198            map = null,
199            bounds = null,
200            infoWindow = null,
201            position = null;
202
203        var build = function() {
204            data.options.scrollwheel = false;
205            data.options.mapTypeId = google.maps.MapTypeId[data.options.mapTypeId];
206            data.options.styles = data.style;
207
208            bounds = new google.maps.LatLngBounds();
209            map = new google.maps.Map(el, data.options);
210            infoWindow = new google.maps.InfoWindow();
211
212            map.setOptions({
213                panControl : data.options.panControl,
214                draggable:  data.options.draggable,
215                zoomControl:  data.options.zoomControl,
216                mapTypeControl:  data.options.scaleControl,
217                scaleControl:  data.options.mapTypeControl,
218            });
219
220            var marker, i;
221
222            map.setTilt(45);
223
224            for (i = 0; i < data.places.length; i++) {
225                if(data.places[i].latitude && data.places[i].longitude) {
226                    position = new google.maps.LatLng(data.places[i].latitude, data.places[i].longitude);
227
228                    bounds.extend(position);
229
230                    marker = new google.maps.Marker({
231                        position: position,
232                        map: map,
233                        title: data.places[i].address,
234                        icon: (data.places[i].marker) ? data.places[i].marker : data.icon
235                    });
236
237
238                    google.maps.event.addListener(marker, 'click', (function(marker, i) {
239                        return function() { 
240                            if(data.places[i].address && data.places[i].address.length > 1) {
241                                infoWindow.setContent('<div class="info_content"><p>'+ data.places[i].address +'</p></div>');
242                                infoWindow.open(map, marker);
243                            } else {
244                                infoWindow.setContent('');
245                                infoWindow.close();
246                            }
247                        };
248                    })(marker, i));
249
250                    /**
251                     * If there is only one marker, map.fitBounds will zoom-in too much.
252                     * Only run map.fitBounds if the markers are more than 1. Use setCenter
253                     * instead if the the marker is only 1.
254                     */
255                    if ( i > 0 ) {
256                        map.fitBounds( bounds );
257                    } else {
258                        // Set latitude and longtitude as float.
259                        var latLang = {
260                            lat: parseFloat( data.places[i].latitude ),
261                            lng: parseFloat( data.places[i].longitude )
262                        };
263                        map.setCenter( latLang );
264                        // Need to setZoom here as we didn't trigger bounds_changed event.
265                        map.setZoom( data.options.zoom );
266                    }
267                }
268            }
269
270            var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) {
271                this.setZoom(data.options.zoom);
272                google.maps.event.removeListener(boundsListener);
273            });
274
275
276            var update = function() {
277                google.maps.event.trigger(map, "resize");
278                map.setCenter(position);
279            };
280            update();
281
282
283            var bindEvents = function() {
284                $( window ).on( 'resize', update );
285                window.addResizeListener( container, update );
286            };
287            bindEvents();
288        };
289
290
291        var initAll = function() {
292            for( var i = 0, l = _toBuild.length; i < l; i++ ) {
293                _toBuild[i]();
294            }
295        };
296
297        MK.api.advancedgmaps = MK.api.advancedgmaps || function() {
298            initAll();
299        };
300
301        return {
302            init : function() {
303                _toBuild.push( build );
304                MK.core.loadDependencies(['https://maps.googleapis.com/maps/api/js?'+apikey+'callback=MK.api.advancedgmaps']);
305            }
306        };
307
308    };
309
310})(jQuery);
311(function($) {
312    'use strict';
313
314    var core = MK.core,
315    	path = MK.core.path;
316
317    MK.component.BannerBuilder = function( el ) {
318    	var init = function(){
319            var $this = $(el),
320                  data = $this.data( 'bannerbuilder-config' );
321
322            MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.flexslider.js' ], function() {
323                $this.flexslider({
324                        selector: '.mk-banner-slides > .mk-banner-slide',
325                        animation: data.animation,
326                        smoothHeight: false,
327                        direction:'horizontal',
328                        slideshow: true,
329                        slideshowSpeed: data.slideshowSpeed,
330                        animationSpeed: data.animationSpeed,
331                        pauseOnHover: true,
332                        directionNav: data.directionNav,
333                        controlNav: false,
334                        initDelay: 2000,
335                        prevText: '',
336                        nextText: '',
337                        pauseText: '',
338                        playText: ''
339                });
340            });
341    	};
342
343    	return {
344    		init : init
345    	};
346    };
347
348})(jQuery);
349
350
351
352
353
354
355
356
357(function($) {
358    'use strict';
359
360    var zIndex = 0;
361
362    $('.mk-newspaper-wrapper').on('click', '.blog-loop-comments', function (event) {
363        event.preventDefault();
364
365        var $this = $(event.currentTarget);
366        var $parent = $this.parents('.mk-blog-newspaper-item');
367
368        $parent.css('z-index', ++zIndex);
369        $this.parents('.newspaper-item-footer').find('.newspaper-social-share').slideUp(200).end().find('.newspaper-comments-list').slideDown(200);
370        setTimeout( function() {
371          MK.utils.eventManager.publish('item-expanded');
372        }, 300);
373    });
374
375    $('.mk-newspaper-wrapper').on('click', '.newspaper-item-share', function (event) {
376        event.preventDefault();
377
378        var $this = $(event.currentTarget);
379        var $parent = $this.parents('.mk-blog-newspaper-item');
380
381        $parent.css('z-index', ++zIndex);
382        $this.parents('.newspaper-item-footer').find('.newspaper-comments-list').slideUp(200).end().find('.newspaper-social-share').slideDown(200);
383        setTimeout( function() {
384          MK.utils.eventManager.publish('item-expanded');
385        }, 300);
386    });
387
388    var init = function init() {
389
390        // setTimeout Trick to make the VC Front Editor to load the images as well
391        setTimeout( function() {
392
393            // Get All Related Layers
394            var $blog = $('.mk-blog-container');
395            var $imgs = $blog.find('img[data-mk-image-src-set]');
396
397            if ( $blog.hasClass('mk-blog-container-lazyload') && $imgs.length ) {
398
399                // Load Images if the user scrolls to them
400                $(window).on('scroll.mk_blog_lazyload', MK.utils.throttle(500, function(){
401                    $imgs.each(function(index, elem) {
402                        if ( MK.utils.isElementInViewport(elem) ) {
403                            MK.component.ResponsiveImageSetter.init( $(elem) );
404                            $imgs = $imgs.not( $(elem) );  // Remove element from the list when loaded to reduce the amount of iteration in each()
405                        }
406                    });
407                }));
408
409                $(window).trigger('scroll.mk_blog_lazyload');
410
411                // Handle the resize
412                MK.component.ResponsiveImageSetter.onResize($imgs);
413
414            } else {
415
416                MK.component.ResponsiveImageSetter.init($imgs);
417                MK.component.ResponsiveImageSetter.onResize($imgs);
418
419            }
420
421        }, 50);
422
423        // If in VC Editor Page, Trigger Resize after 2 second (AM-2490)
424        // This is to fix the Pagination Overlapping issue on first initial blog insert as it takes VC about 1 second to change the Blog Layout on initial stage
425        if ( $('body').hasClass('vc_editor') ) {
426            setTimeout( function() {
427                $(window).trigger('resize');
428            }, 2000) 
429        }
430
431    }
432
433    init();
434
435    // VC Front-End Editor
436    $(window).on('vc_reload', init);
437
438}(jQuery));
439(function($) {
440    'use strict';
441
442    var core = MK.core,
443    	path = MK.core.path;
444
445    // TODO: Repair after Rifat. He repeated The same code twice - other same code is in photoalbum (why by the way?!).
446    // Split it into two separate components when you see reusage
447    MK.component.Category = function( el ) {
448        var init = function(){
449			core.loadDependencies([ path.plugins + 'pixastic.js' ], function() {
450         		blurImage($('.blur-image-effect .mk-loop-item .item-holder '));
451         	});
452
453			core.loadDependencies([ path.plugins + 'minigrid.js' ], masonry);
454        };
455
456        var blurImage = function($item) {
457         	return $item.each(function() {
458				var $_this = $(this);
459
460				var img = $_this.find('.item-thumbnail');
461
462				img.clone().addClass("blur-effect item-blur-thumbnail").removeClass('item-thumbnail').prependTo(this);
463
464				var blur_this = $(".blur-effect", this);
465					blur_this.each(function(index, element){
466						if (img[index].complete === true) {
467							Pixastic.process(blur_this[index], "blurfast", {amount:0.5});
468						}
469						else {
470							blur_this.load(function () {
471								Pixastic.process(blur_this[index], "blurfast", {amount:0.5});
472							});
473						}
474					});
475			});
476        };
477
478        // TODO: find other shortcodes like this design and make it as a component
479        var masonry = function() {
480        	if(!$('.js-masonry').length) return;
481
482	        function grid() {
483	            minigrid({
484		            container: '.js-masonry',
485		            item: '.js-masonry-item',
486		            gutter: 0
487	            });
488	        }
489
490	        grid();
491	        $(window).on('resize', grid);
492        };
493
494        return {
495         	init : init
496        };
497    };
498
499})(jQuery);
500
501
502
503
504
505
506
507
508(function($) {
509    'use strict';
510
511    var core = MK.core,
512        path = core.path;
513
514    MK.component.Chart = function(el) {
515        var init = function() {
516            MK.core.loadDependencies([MK.core.path.plugins + 'jquery.easyPieChart.js'], function() {
517                $('.mk-chart__chart').each(function() {
518                    var $this = $(this),
519                        $parent_width = $(this).parent().width(),
520                        $chart_size = parseInt($this.attr('data-barSize'));
521
522                    if ($parent_width < $chart_size) {
523                        $chart_size = $parent_width;
524                        $this.css('line-height', $chart_size);
525                        $this.find('i').css({
526                            'line-height': $chart_size + 'px'
527                        });
528                        $this.css({
529                            'line-height': $chart_size + 'px'
530                        });
531                    }
532
533                    var build = function() {
534                        $this.easyPieChart({
535                            animate: 1300,
536                            lineCap: 'butt',
537                            lineWidth: $this.attr('data-lineWidth'),
538                            size: $chart_size,
539                            barColor: $this.attr('data-barColor'),
540                            trackColor: $this.attr('data-trackColor'),
541                            scaleColor: 'transparent',
542                            onStep: function(value) {
543                                this.$el.find('.chart-percent span').text(Math.ceil(value));
544                            }
545                        });
546                    };
547
548                    // refactored only :in-viewport logic. rest is to-do
549                    MK.utils.scrollSpy(this, {
550                        position: 'bottom',
551                        after: build
552                    });
553                });
554            });
555        };
556
557        return {
558            init: init
559        };
560    };
561
562})(jQuery);
563
564(function($) {
565    "use strict";
566
567    $('.mk-clients.column-style').each(function() {
568        var $group = $(this),
569            $listItems = $group.find('li'),
570            listItemsCount = $listItems.length,
571            listStyle = $group.find('ul').attr('style') || '',
572            fullRowColumnsCount = $group.find('ul:first-of-type li').length;
573
574        function recreateGrid() { 
575            var i;
576
577            $listItems.unwrap();
578
579            if (window.matchMedia('(max-width: 550px)').matches && fullRowColumnsCount >= 1) {
580                for (i = 0; i < listItemsCount; i += 1) {
581                    $listItems.slice(i, i + 1)
582                        .wrapAll('<ul class="mk-clients-fixed-list" style="' + listStyle + '"></ul>');
583                }
584            } else if (window.matchMedia('(max-width: 767px)').matches && fullRowColumnsCount >= 2) {
585                for (i = 0; i < listItemsCount; i += 2) {
586                    $listItems.slice(i, i + 2)
587                        .wrapAll('<ul class="mk-clients-fixed-list" style="' + listStyle + '"></ul>');
588                }
589            } else if (window.matchMedia('(max-width: 960px)').matches && fullRowColumnsCount >= 3) {
590                for (i = 0; i < listItemsCount; i += 3) {
591                    $listItems.slice(i, i + 3)
592                        .wrapAll('<ul class="mk-clients-fixed-list" style="' + listStyle + '"></ul>');
593                }
594            } else {
595                for (i = 0; i < listItemsCount; i += fullRowColumnsCount) {
596                    $listItems.slice(i, i + fullRowColumnsCount)
597                        .wrapAll('<ul style="' + listStyle + '"></ul>');
598                }
599            }
600        }
601        
602        recreateGrid();
603        $(window).on('resize', recreateGrid);
604
605    });
606
607}(jQuery));
608(function($) {
609    'use strict';
610    // Update countdown style in VC FEE - AM-2684.
611    $(window).on('vc_reload', function() {
612        $('.mk-event-countdown-ul').each(function() {
613            if ($(this).width() < 750) {
614                $(this).addClass('mk-event-countdown-ul-block');
615            } else {
616                $(this).removeClass('mk-event-countdown-ul-block');
617            }
618        });
619    });
620})(jQuery);
621(function($) {
622	'use strict';
623
624    $('.mk-edge-slider').find('video').each(function() {
625        this.pause();
626        this.currentTime = 0;
627    });
628
629	MK.component.EdgeSlider = function( el ) {
630		var self = this,
631			$this = $( el ), 
632            $window = $(window),
633            $wrapper = $this.parent(),
634			config = $this.data( 'edgeslider-config' ),
635            $nav = $( config.nav ),
636            $prev = $nav.find( '.mk-edge-prev' ),
637            $prevTitle = $prev.find( '.nav-item-caption' ),
638            $prevBg = $prev.find('.edge-nav-bg'),
639            $next = $nav.find( '.mk-edge-next' ),
640            $nextTitle = $next.find( '.nav-item-caption' ),
641            $nextBg = $next.find('.edge-nav-bg'),
642            $navBtns = $nav.find( 'a' ),  
643            $pagination = $( '.swiper-pagination' ),
644            $skipBtn = $( '.edge-skip-slider' ),
645            $opacityLayer = $this.find('.edge-slide-content'),
646            $videos = $this.find('video'),
647            currentSkin = null,
648            currentPoint = null,
649            winH = null,
650            opacity = null,
651            offset = null;
652
653        var callbacks = { 
654    		onInitialize : function( slides ) {
655    			self.$slides = $( slides );
656				
657				self.slideContents = $.map( self.$slides, function( slide ) {
658					var $slide = $( slide ),
659						title = $slide.find('.edge-slide-content .edge-title').first().text(),
660						skin = $slide.attr("data-header-skin"),
661						image = $slide.find('.mk-section-image').attr('data-thumb') || 
662								$slide.find('.mk-video-section-touch').attr('data-thumb'),
663						bgColor = $slide.find('.mk-section-image').css('background-color');
664
665
666					return {
667						skin: skin,
668						title: title,
669						image: image,
670						bgColor: bgColor
671					};
672				});
673
674                // Set position fixed here rather than css to avoid flash of strangely styled slides befor plugin init
675                if(MK.utils.isSmoothScroll) $this.css('position', 'fixed');
676
677				setNavigationContent( 1, self.$slides.length - 1 );
678				setSkin( 0 );
679                // stopVideos();
680                playVideo(0);
681
682                setTimeout( function() {
683                    $( '.edge-slider-loading' ).fadeOut( '100' );
684                }, 1000 );
685    		},
686
687            onBeforeSlide : function( id ) {
688                
689            },
690
691    		onAfterSlide : function( id ) {
692    			setNavigationContent( nextFrom(id), prevFrom(id) );
693    			setSkin( id );   
694                stopVideos(); // stop all others if needed
695                playVideo( id );
696    		}
697    	};
698
699
700        var nextFrom = function nextFrom(id) {
701            return ( id + 1 === self.$slides.length ) ? 0 : id + 1;
702        };
703
704
705        var prevFrom = function prevFrom(id) {
706            return ( id - 1 === -1 ) ? self.$slides.length - 1 : id - 1;
707        };
708
709
710        var setNavigationContent = function( nextId, prevId ) {
711            if(self.slideContents[ prevId ]) {
712        		$prevTitle.text( self.slideContents[ prevId ].title );
713        		$prevBg.css( 'background', 
714        			self.slideContents[ prevId ].image !== 'none' ? 
715        				'url(' + self.slideContents[ prevId ].image + ')' :
716        				self.slideContents[ prevId ].bgColor );
717            }
718
719            if(self.slideContents[ nextId ]) {
720        		$nextTitle.text( self.slideContents[ nextId ].title );
721        		$nextBg.css( 'background', 
722        			self.slideContents[ nextId ].image !== 'none' ? 
723        				'url(' + self.slideContents[ nextId ].image + ')' :
724        				self.slideContents[ nextId ].bgColor );
725            }
726        };
727
728
729        var setSkin = function setSkin( id ) {  
730        	currentSkin = self.slideContents[ id ].skin;
731
732          	$navBtns.attr('data-skin', currentSkin);
733          	$pagination.attr('data-skin', currentSkin);
734         	$skipBtn.attr('data-skin', currentSkin); 
735
736         	if( self.config.firstEl ) {
737         		MK.utils.eventManager.publish( 'firstElSkinChange', currentSkin );
738         	}
739        };
740
741
742        var stopVideos = function stopVideos() {
743            $videos.each(function() {
744                this.pause();
745                this.currentTime = 0;
746            });
747        };
748
749
750        var playVideo = function playVideo(id) {
751            var video = self.$slides.eq(id).find('video').get(0);
752            if(video) {
753                video.play();
754                console.log('play video in slide nr ' + id);
755            }
756
757        };
758
759
760        var onResize = function onResize() {
761            var height = $wrapper.height();
762            $this.height( height );
763
764            var width = $wrapper.width();
765            $this.width( width );
766
767            winH = $window.height();
768            offset = $this.offset().top;
769
770            if(!MK.utils.isSmoothScroll) return; 
771            if(MK.utils.isResponsiveMenuState()) {
772                // Reset our parallax layers position and styles when we're in responsive mode
773                $this.css({
774                    '-webkit-transform': 'translateZ(0)',
775                    '-moz-transform': 'translateZ(0)',
776                    '-ms-transform': 'translateZ(0)',
777                    '-o-transform': 'translateZ(0)',
778                    'transform': 'translateZ(0)',
779                    'position': 'absolute'
780                });
781                $opacityLayer.css({
782                    'opacity': 1
783                });
784            } else {
785                // or proceed with scroll logic when we assume desktop screen
786                onScroll();
787            }
788        };
789
790        var onScroll = function onScroll() {
791            currentPoint = - MK.val.scroll();
792
793            if( offset + currentPoint <= 0 ) {
794                opacity = 1 + ((offset + currentPoint) / winH) * 2;
795                opacity = Math.min(opacity, 1);
796                opacity = Math.max(opacity, 0);
797
798                $opacityLayer.css({
799                    opacity: opacity
800                });
801            }
802
803            $this.css({
804                '-webkit-transform': 'translateY(' + currentPoint + 'px) translateZ(0)',
805                '-moz-transform': 'translateY(' + currentPoint + 'px) translateZ(0)',
806                '-ms-transform': 'translateY(' + currentPoint + 'px) translateZ(0)',
807                '-o-transform': 'translateY(' + currentPoint + 'px) translateZ(0)',
808                'transform': 'translateY(' + currentPoint + 'px) translateZ(0)',
809                'position': 'fixed'
810            });  
811        };
812
813        onResize();
814        $window.on('load', onResize);
815        $window.on('resize', onResize);
816        window.addResizeListener( $wrapper.get(0), onResize );
817
818        if(MK.utils.isSmoothScroll) {
819            onScroll();
820            $window.on('scroll', function() {
821                if(MK.utils.isResponsiveMenuState()) return;
822                window.requestAnimationFrame(onScroll);
823            });
824        }
825
826		this.el = el;
827		this.config = $.extend( config, callbacks );
828		this.slideContents = null; // cache slide contents
829
830        // Let mk_slider know it's EdgeSlider
831        this.config.edgeSlider = true;
832	};
833
834	MK.component.EdgeSlider.prototype = {
835		init : function() {
836			// Inherit from Slider. add prototypes if needed
837			var slider = new MK.ui.Slider( this.el, this.config );
838			slider.init();
839		}
840	};
841
842})(jQuery);
843(function ($) {
844	'use strict';
845
846var init = function init() {
847	$('.mk-faq-wrapper').each( function() {
848		var $this = $(this);
849		var $filter = $this.find('.filter-faq');
850		var $filterItem = $filter.find('a');
851		var $faq = $this.find('.mk-faq-container > div');
852		var currentFilter = '';
853
854		$filterItem.on('click', function(e) {
855			var $this = $(this);
856
857			currentFilter = $this.data('filter');
858			$filterItem.removeClass('current');
859			$this.addClass('current');
860
861			filterItems( currentFilter );
862
863			e.preventDefault();
864		});
865
866		function filterItems( cat ) {
867			if( cat === '' ) {
868				$faq.slideDown(200).removeClass('hidden');
869				return;
870			}
871			$faq.not( '.' + cat ).slideUp(200).addClass('hidden');
872			$faq.filter( '.' + cat ).slideDown(200).removeClass('hidden');
873		}
874	});
875}
876init();
877$(window).on('vc_reload', init);
878
879}( jQuery ));
880/* Flickr Feeds */
881/* -------------------------------------------------------------------- */
882(function ($) {
883    'use strict';
884function mk_flickr_feeds() {
885
886    $('.mk-flickr-feeds').each(function() {
887        var $this = $(this),
888            apiKey = $this.attr('data-key'),
889            userId = $this.attr('data-userid'),
890            perPage = $this.attr('data-count'),
891            column = $this.attr('data-column');
892
893        if ( ! $( '.mk-flickr-feeds' ).is( ':empty' ) ) {
894            return;
895        }
896
897        jQuery.getJSON('https://api.flickr.com/services/rest/?format=json&method=' + 'flickr.photos.search&api_key=' + apiKey + '&user_id=' + userId + '&&per_page=' + perPage + '&jsoncallback=?', function(data) {
898
899            jQuery.each(data.photos.photo, function(i, rPhoto) {
900                var basePhotoURL = 'http://farm' + rPhoto.farm + '.static.flickr.com/' + rPhoto.server + '/' + rPhoto.id + '_' + rPhoto.secret;
901
902                var thumbPhotoURL = basePhotoURL + '_q.jpg';
903                var mediumPhotoURL = basePhotoURL + '.jpg';
904
905                var photoStringStart = '<a ';
906                var photoStringEnd = 'title="' + rPhoto.title + '" rel="flickr-feeds" class="mk-lightbox flickr-item a_colitem" href="' + mediumPhotoURL + '"><img src="' + thumbPhotoURL + '" alt="' + rPhoto.title + '"/></a>;';
907                var photoString = (i < perPage) ? photoStringStart + photoStringEnd : photoStringStart + photoStringEnd;
908
909                jQuery(photoString).appendTo($this);
910            });
911        });
912    });
913
914}
915    mk_flickr_feeds();
916    $( window ).on( 'vc_reload', mk_flickr_feeds );
917})(jQuery);
918jQuery(function($) {
919
920  'use strict';
921
922  // Get All Related Layers
923  var init = function init() {
924    var $gallery = $('.mk-gallery');
925    var $imgs = $gallery.find('img[data-mk-image-src-set]');
926
927    if ( $gallery.hasClass('mk-gallery-lazyload') && $imgs.length ) {
928
929      // Load Images if the user scrolls to them
930      $(window).on('scroll.mk_gallery_lazyload', MK.utils.throttle(500, function(){
931        $imgs.each(function(index, elem) {
932          if ( MK.utils.isElementInViewport(elem) ) {
933            MK.component.ResponsiveImageSetter.init( $(elem) );
934            $imgs = $imgs.not( $(elem) );  // Remove element from the list when loaded to reduce the amount of iteration in each()
935          }
936        });
937      }));
938
939      $(window).trigger('scroll.mk_gallery_lazyload');
940
941      // Handle the resize
942      MK.component.ResponsiveImageSetter.onResize($imgs);
943
944    } else {
945
946      MK.component.ResponsiveImageSetter.init($imgs);
947      MK.component.ResponsiveImageSetter.onResize($imgs);
948
949    }
950  }
951
952  init();
953  $(window).on('vc_reload', init);
954
955});
956
957
958
959(function($) {
960    'use strict';
961    // Move header to last wrapper of page section if its added into page section. 
962    $('.js-header-shortcode').each(function() {
963        var $this = $(this),
964            $parent_page_section = $this.parents('.mk-page-section'),
965            $parent_row = $this.parents('.js-master-row'),
966            $is_inside = $parent_page_section.attr('id');
967        if ($is_inside) {
968            $this.detach().appendTo($parent_page_section);
969        }
970        /* Its needed for sub menus to appear */
971        $parent_page_section.css({
972            'overflow': 'visible'
973        });
974        $parent_row.css({
975            'overflow': 'visible'
976        });
977        /* Fix: AM-1918 Add z-index to the header shortcode parent element so that menu is visible on responsive screen when menu icon is clicked */
978        $this.parent().css('z-index', 99999);
979    });
980})(jQuery);
981(function($) {
982  'use strict';
983
984  /* Page Section Intro Effects */
985  /* -------------------------------------------------------------------- */
986
987  function mk_section_intro_effects() {
988    if (!MK.utils.isMobile()) {
989      if (!$.exists('.mk-page-section.intro-true')) return;
990
991      $('.mk-page-section.intro-true').each(function() {
992        var that = this;
993        MK.core.loadDependencies([ MK.core.path.plugins + 'jquery.sectiontrans.js', MK.core.path.plugins + 'tweenmax.js' ], function() {
994          var $this = $(that),
995            $pageCnt = $this.parent().nextAll('div'),
996            windowHeight = $(window).height(),
997            effectName = $this.attr('data-intro-effect'),
998            $header = $('.mk-header');
999
1000          var effect = {
1001            fade: new TimelineLite({paused: true})
1002              .set($pageCnt, { opacity: 0, y: windowHeight * 0.3 })
1003              .to($this, 1, { opacity: 0, ease:Power2.easeInOut })
1004              .to($pageCnt, 1, { opacity: 1, y: 0, ease:Power2.easeInOut}, "-=.7")
1005              .set($this, { zIndex: '-1'}),
1006
1007            zoom_out: new TimelineLite({paused: true})
1008              .set($pageCnt, { opacity: 0, y: windowHeight * 0.3})
1009              .to($this, 1.5, { opacity: .8, scale: 0.8, y: -windowHeight - 100, ease:Strong.easeInOut })
1010              .to($pageCnt, 1.5, { opacity: 1, y:  0, ease:Strong.easeInOut}, "-=1.3"),
1011
1012            shuffle: new TimelineLite({paused: true})
1013              .to($this, 1.5, { y: -windowHeight/2, ease:Strong.easeInOut })
1014              .to($pageCnt.first(), 1.5, { paddingTop: windowHeight/2, ease:Strong.easeInOut }, "-=1.3")
1015          };
1016
1017          console.log($pageCnt);
1018        
1019
1020          $this.sectiontrans({
1021            effect: effectName
1022          });
1023
1024          if($this.hasClass('shuffled')) {
1025            TweenLite.set($this, { y: -windowHeight/2 });
1026            TweenLite.set($this.nextAll('div').first(), { paddingTop: windowHeight/2 });
1027          }
1028
1029          $('body').on('page_intro', function() {
1030            MK.utils.scroll.disable();
1031            $(this).data('intro', true);
1032            effect[effectName].play();
1033            setTimeout(function() {
1034              $header.addClass('pre-sticky');
1035              $header.addClass('a-sticky');
1036              $('.mk-header-padding-wrapper').addClass('enable-padding');
1037              $('body').data('intro', false);
1038              if(effectName === 'shuffle') $this.addClass('shuffled');
1039            }, 1000);
1040
1041            setTimeout(MK.utils.scroll.enable, 1500);
1042          });
1043
1044          $('body').on('page_outro', function() {
1045            MK.utils.scroll.disable();
1046            $(this).data('intro', true);
1047            effect[effectName].reverse();
1048            setTimeout(function() {
1049              $header.removeClass('pre-sticky');
1050              $header.removeClass('a-sticky');
1051              $('.mk-header-padding-wrapper').removeClass('enable-padding');
1052              $('body').data('intro', false);
1053              if($this.hasClass('shuffled')) $this.removeClass('shuffled');
1054            }, 1000);
1055            
1056            setTimeout(MK.utils.scroll.enable, 1500);
1057          });
1058        });
1059      });
1060
1061    } else {
1062      $('.mk-page-section.intro-true').each(function() {
1063        $(this).attr('data-intro-effect', '');
1064      });
1065    }
1066  }
1067
1068  mk_section_intro_effects();
1069
1070  var debounceResize = null;
1071  $(window).on("resize", function() {
1072    if( debounceResize !== null ) { clearTimeout( debounceResize ); }
1073    debounceResize = setTimeout( mk_section_intro_effects, 300 );
1074  });
1075  
1076  /* Page Section Adaptive Height */
1077  /* -------------------------------------------------------------------- */
1078    
1079  function mk_section_adaptive_height() {
1080      $( ".mk-page-section.mk-adaptive-height" ).each( function() {
1081          var imageHeight = $( this ).find( ".mk-adaptive-image" ).height();
1082          $( this ).css( "height", imageHeight );
1083      });
1084  }
1085  
1086  $( window ).on( "load resize", mk_section_adaptive_height );
1087
1088
1089  /* Page Section Image Loader */
1090  /* -------------------------------------------------------------------- */
1091
1092  // Get All Related Layers
1093  var init = function init() {
1094    var $allLayers = $('.mk-page-section .background-layer').filter(function(index) {
1095      var isLazyLoad = $(this).attr('data-mk-lazyload') === 'true';
1096      if ( !isLazyLoad ) {
1097        MK.component.BackgroundImageSetter.init( $(this) );
1098      }
1099      return isLazyLoad;
1100    });;
1101    
1102    // Load BG Images if the user scroll to them
1103    if ( $allLayers.length ) {
1104
1105      $(window).on('scroll.mk_page_section_lazyload', MK.utils.throttle(500, function(){
1106        $allLayers.each(function(index, elem) {
1107          if ( MK.utils.isElementInViewport(elem) ) {
1108            MK.component.BackgroundImageSetter.init( $(elem) );
1109            $allLayers = $allLayers.not( $(elem) );  // Remove element from the list when loaded to reduce the amount of iteration in each()
1110          }
1111        });
1112      }));
1113
1114      // First init
1115      $(window).trigger('scroll.mk_page_section_lazyload');
1116
1117      // Handle the resize
1118      MK.component.BackgroundImageSetter.onResize($allLayers);
1119
1120    }
1121  }
1122  init();
1123
1124  $(window).on('vc_reload', init);
1125
1126  /* Page Section Layout */
1127  /* -------------------------------------------------------------------- */
1128
1129  function mk_section_half_layout() {
1130    $(".mk-page-section.half_boxed").each(function() {
1131      var $section = $(this);
1132      if ($(window).width() > mk_grid_width) {
1133        var margin = ($(window).width() - mk_grid_width) / 2;
1134        var $section_inner = $section.find('.mk-half-layout-inner');
1135        if($section.hasClass('half_left_layout')){
1136          $section_inner.css({
1137            marginRight: margin + 'px'
1138          });
1139        }
1140        if($section.hasClass('half_right_layout')){
1141          $section_inner.css({
1142            marginLeft: margin + 'px'
1143          });
1144        }
1145      }
1146    });
1147  }
1148
1149  $(window).on("load resize", mk_section_half_layout);
1150
1151	/* Page Section - Fluid Width Equal Height Columns */
1152	/* -------------------------------------------------------------------- */
1153	function mk_reset_section_fluid_width_equal_height_columns() {
1154		var $colWrappers = '', maxWidth = 850;
1155
1156		$colWrappers = $('.page-section-content.fluid-width-equal-height-columns');
1157
1158		$colWrappers.each(function() {
1159			var $colWrapper = '', colHeight = 0;
1160			$colWrapper = $(this);
1161			$colWrapper.find('.wpb_column.column_container').each(function() {
1162				var $col = $(this), size = $(this).children('div').length;
1163				if (size > 0) {
1164					$col.removeAttr("style");
1165					$col.children('div').each(function() {
1166						var $this = $( this );
1167						/**
1168						 * Fix Advanced Google Maps (AGM) issue on page section.
1169						 *
1170						 * Problem: AGM set the height as inline CSS property (style attribute).
1171						 * In this case, the style attribute will be removed before checking the
1172						 * elements height in each of the column. That's why AGM container will
1173						 * loose the height and the map can't be displayed properly (only 1px)
1174						 * because it overlap other row in the page. We need to check if current
1175						 * element is AGM or not before removing style attribute of the element.
1176						 */
1177						if ( ! $this.hasClass( 'mk-advanced-gmaps' ) ) {
1178							$this.removeAttr( 'style' );
1179						}
1180					});
1181				}
1182			});
1183		});
1184	}
1185
1186	function mk_section_fluid_width_equal_height_columns() {
1187		mk_reset_section_fluid_width_equal_height_columns();
1188
1189		var $colWrappers = '', maxWidth = 850, $pageSection = $('.page-section-content');
1190
1191		if ( ! $pageSection.hasClass('.fluid-width-equal-height-columns') ) {
1192			$pageSection.find('.wpb_column.column_container').removeAttr( 'style' );
1193			$pageSection.find('.wpb_column.column_container .vc_element').removeAttr( 'style' );
1194		}
1195
1196		$colWrappers = $('.page-section-content.fluid-width-equal-height-columns');
1197
1198		$colWrappers.each(function() {
1199			var $colWrapper = '', colHeight = 0;
1200			$colWrapper = $(this);
1201
1202			if ($colWrapper.length > 0) {
1203				/* Get the minimum height of the wrapper */
1204				colHeight = $colWrappers.outerHeight(true);
1205				$colWrapper.find('.wpb_column.column_container').each(function() {
1206					var $col = $(this);
1207					if ($col.length > 0) {
1208						colHeight = ($col.outerHeight(true) > colHeight) ? $col.outerHeight(true) : colHeight;
1209					}
1210				});
1211			}
1212
1213			if (colHeight > 0) {
1214				$colWrapper.find('.wpb_column.column_container').each(function() {
1215					var $col = $(this), size = $(this).children('div').length;
1216					if (size > 0) {
1217						colHeight = ($(window).width() < maxWidth) ? 'initial' : colHe
1217ight;
1218						$col.css("height", colHeight);
1219						if ($colWrapper.hasClass('vertical-align-center')) {
1220							$col.children('div').each(function() {
1221								var elHeight = ($(window).width() < maxWidth) ? 'initial' : (colHeight/size);
1222								/**
1223								 * Fix Advanced Google Maps (AGM) issue on page section.
1224								 */
1225								if ( ! $(this).hasClass( 'mk-advanced-gmaps' ) ) {
1226									$(this).css("height", elHeight);
1227								}
1228							});
1229						}
1230					}
1231				});
1232			}
1233		});
1234	}
1235	$(window).on('load vc_reload', function() {
1236		setTimeout(function() {
1237		/* 
1238			Somehow the values are not correctly updated for the screens
1239			and we need to put setTimeout to fix the issue.
1240		*/
1241		mk_section_fluid_width_equal_height_columns();
1242		}, 500);
1243	});
1244
1245	var debounceResize = null;
1246	$(window).on("resize", function() {
1247		if( debounceResize !== null ) { clearTimeout( debounceResize ); }
1248		debounceResize = setTimeout( mk_section_fluid_width_equal_height_columns(), 500 );
1249	});
1250
1251}(jQuery));
1252(function($) {
1253	'use strict';
1254
1255	function mk_page_title_parallax() {
1256	    if (!MK.utils.isMobile() && mk_smooth_scroll !== 'false') {
1257
1258	        $('.mk-effect-wrapper').each(function() {
1259	            var $this = $(this),
1260                	progressVal,
1261                    currentPoint,
1262                    ticking = false,
1263                    scrollY = MK.val.scroll(),
1264                    $window = $(window),
1265                    windowHeight = $(window).height(),
1266                    parentHeight = $this.outerHeight(),
1267                    startPoint = 0,
1268                    endPoint = $this.offset().top + parentHeight,
1269                    effectLayer = $this.find('.mk-effect-bg-layer'),
1270                    gradientLayer = effectLayer.find('.mk-effect-gradient-layer'),
1271                    cntLayer = $this.find('.mk-page-title-box-content'),
1272                    animation = effectLayer.attr('data-effect'),
1273                    top = $this.offset().top,
1274                    height = $this.outerHeight();
1275
1276                var parallaxSpeed = 0.7,
1277                    zoomFactor = 1.3;
1278
1279                var parallaxTopGap = function() {
1280                    var gap = top * parallaxSpeed;
1281
1282                    effectLayer.css({
1283                        height : height + gap + 'px',
1284                        top : (-gap) + 'px'
1285                    });
1286                };
1287
1288
1289                if (animation == ("parallax" || "parallaxZoomOut") ) {
1290                    parallaxTopGap();
1291                }
1292
1293                var animationSet = function() {
1294                    scrollY = MK.val.scroll();
1295
1296                    if (animation == "parallax") {
1297                        currentPoint = (startPoint + scrollY) * parallaxSpeed;
1298                        effectLayer.get(0).style.transform = 'translateY(' + currentPoint + 'px)';
1299                    }
1300
1301                    if (animation == "parallaxZoomOut") {
1302                    	console.log(effectLayer);
1303                        currentPoint = (startPoint + scrollY) * parallaxSpeed;
1304                        progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint));
1305                        var zoomCalc = zoomFactor - ((zoomFactor - 1) * progressVal);
1306
1307                        effectLayer.get(0).style.transform = 'translateY(' + currentPoint + 'px) scale(' + zoomCalc + ')';
1308                    }
1309
1310                    if (animation == "gradient") {
1311                        progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint));
1312                        gradientLayer.css({
1313                            opacity: progressVal * 2
1314                        });
1315                    }
1316
1317                    if (animation != "gradient") {
1318                        progressVal = (1 / (endPoint - startPoint) * (scrollY - startPoint));
1319                        cntLayer.css({
1320                            opacity: 1 - (progressVal * 4)
1321                        });
1322                    }
1323
1324                    // Stop ticking
1325                    ticking = false;
1326                };
1327                animationSet();
1328
1329                // This will limit the calculation of the background position to
1330                // 60fps as well as blocking it from running multiple times at once
1331                var requestTick = function() {
1332                    if (!ticking) {
1333                        window.requestAnimationFrame(animationSet);
1334                        ticking = true;
1335                    }
1336                };
1337
1338                $window.off('scroll', requestTick);
1339                $window.on('scroll', requestTick);
1340
1341	        });
1342	    }
1343	}
1344
1345
1346	var $window = $(window);
1347	var debounceResize = null;
1348
1349	$window.on('load', mk_page_title_parallax);
1350    $window.on("resize", function() {
1351        if( debounceResize !== null ) { clearTimeout( debounceResize ); }
1352        debounceResize = setTimeout( mk_page_title_parallax, 300 );
1353    });
1354
1355}(jQuery));
1356(function( $ ) {
1357	'use strict';
1358
1359	var utils = MK.utils,
1360		core  = MK.core,
1361		path  = MK.core.path;
1362
1363	MK.component.PhotoAlbum = function( el ) {
1364		this.album = el;
1365		this.initialOpen = false;
1366	};
1367
1368
1369	MK.component.PhotoAlbum.prototype = { 
1370		dom: {
1371			gallery 			: '.slick-slider-wrapper',
1372			title 				: '.slick-title',
1373			galleryContainer 	: '.slick-slides',
1374			closeBtn 			: '.slick-close-icon',
1375			thumbList 			: '.slick-dots',
1376			thumbs 				: '.slick-dots li',
1377			imagesData  		: 'photoalbum-images',
1378			titleData  			: 'photoalbum-title',
1379			idData  			: 'photoalbum-id',
1380			urlData  			: 'photoalbum-url',
1381			activeClass 		: 'is-active'
1382		},
1383 
1384		tpl: {
1385			gallery: '#tpl-photo-album',
1386			slide: '<div class="slick-slide"></div>'
1387		},
1388
1389		init: function() {  
1390			this.cacheElements();
1391			this.bindEvents();
1392			this.openByLink();
1393		},
1394
1395		cacheElements: function() {
1396			this.$album = $( this.album );
1397			this.imagesSrc = this.$album.data( this.dom.imagesData );
1398
1399			this.albumLength = this.imagesSrc.length; 
1400
1401			this.title = this.$album.data( this.dom.titleData );
1402			this.id = this.$album.data( this.dom.idData );
1403			this.url = this.$album.data( this.dom.urlData );
1404
1405			this.images = []; // stores dom objects to insert into gallery instance
1406		},
1407
1408		bindEvents: function() {
1409			this.$album.not('[data-photoalbum-images="[null]"]').on( 'click', this.albumClick.bind( this ) );
1410			$( document ).on( 'click', this.dom.closeBtn, this.closeClick.bind( this ) );
1411			$( window ).on( 'resize', this.thumbsVisibility.bind( this ) );
1412			$( window ).on( 'resize', this.makeArrows.bind( this ) );
1413		},
1414
1415		albumClick: function( e ) {
1416			e.preventDefault();
1417			this.open();
1418			MK.ui.loader.add(this.album);
1419		},
1420
1421		closeClick: function( e ) {
1422			e.preventDefault();
1423
1424			// Because one close btn rules them all 
1425			if( this.slider ) {
1426				this.removeGallery();
1427				this.slider.exitFullScreen();  
1428			}
1429		},
1430
1431		thumbsVisibility: function() {
1432			if( !this.thumbsWidth ) return;
1433			if( window.matchMedia( '(max-width:'+ (this.thumbsWidth + 260) +'px)' ).matches ) this.hideThumbs(); // 260 is 2 * 120 - right corner buttons width + scrollbar
1434			else this.showThumbs();
1435		},
1436
1437		hideThumbs: function() {
1438			if( ! this.$thumbList ) return;
1439			this.$thumbList.hide();
1440		},
1441
1442		showThumbs: function() {
1443			if( ! this.$thumbList ) return;
1444			this.$thumbList.show();
1445		},
1446
1447		open: function() {
1448			var self = this;
1449			core.loadDependencies([ path.plugins + 'slick.js' ], function() {
1450				self.createGallery();
1451				self.loadImages();
1452			});
1453		},
1454
1455		createGallery: function() {
1456			// only one per page
1457			if( ! $( this.dom.gallery ).length ) {
1458				var tpl = $( this.tpl.gallery ).eq( 0 ).html();
1459				$( 'body' ).append( tpl );
1460			}
1461			// and cache obj
1462			this.$gallery = $( this.dom.gallery ); 
1463			this.$closeBtn = $( this.dom.closeBtn );
1464		},
1465
1466		createSlideshow : function() {
1467			var self = this;
1468
1469			this.slider = new MK.ui.FullScreenGallery( this.dom.galleryContainer, {
1470				id: this.id,
1471				url: this.url
1472			});
1473			this.slider.init();
1474
1475			$(window).trigger('resize');
1476			this.makeArrows();
1477
1478			this.$thumbList = $( this.dom.thumbList );
1479			this.$thumbs = $( this.dom.thumbs ); 
1480			this.thumbsWidth = (this.$thumbs.length) * 95;
1481			this.thumbsVisibility();
1482
1483			setTimeout(function() {
1484				MK.ui.loader.remove(self.album);
1485			}, 100);
1486
1487			MK.utils.eventManager.publish('photoAlbum-open');
1488		},
1489
1490		makeArrows: function() {
1491			if (this.arrowsTimeout) clearTimeout(this.arrowsTimeout);
1492			this.arrowsTimeout = setTimeout(function() {
1493				var $prev = $('.slick-prev').find('svg');
1494				var $next = $('.slick-next').find('svg');
1495
1496				$prev.wrap('<div class="slick-nav-holder"></div>');
1497				$next.wrap('<div class="slick-nav-holder"></div>');
1498
1499				if(matchMedia("(max-width: 1024px)").matches) {
1500					$prev.attr({width: 12, height: 22}).find('polyline').attr('points', '12,0 0,11 12,22');
1501					$next.attr({width: 12, height: 22}).find('polyline').attr('points', '0,0 12,11 0,22');
1502				} else {
1503					$prev.attr({width: 33, height: 65}).find('polyline').attr('points', '0.5,0.5 32.5,32.5 0.5,64.5');
1504					$next.attr({width: 33, height: 65}).find('polyline').attr('points', '0.5,0.5 32.5,32.5 0.5,64.5');
1505				}
1506			}, 0);
1507		},
1508
1509		loadImages: function() {
1510			var self = this,
1511				n = 0;
1512
1513			// cache images on first load. 
1514			if( ! this.images.length ) {
1515				this.imagesSrc.forEach( function( src ) {
1516					if(src === null) return; // protect from nulls
1517					var img = new Image(); 
1518
1519					img.onload = function() {
1520						self.onLoad( n += 1 );
1521					};
1522
1523					img.src = src; 
1524					self.images.push( img );
1525				});
1526			} else {
1527				this.onLoad( this.albumLength );
1528			}
1529		},
1530
1531		onLoad : function( n ) {
1532			if( n === this.albumLength ) {
1533				this.insertImages(); 
1534				this.showGallery();
1535				this.createSlideshow();
1536			}
1537		},
1538
1539		insertImages : function() {
1540			var $galleryContainer = this.$gallery.find( this.dom.galleryContainer ),
1541				$title = $( this.dom.title ),
1542				slide = this.tpl.slide;
1543
1544			// clear first
1545			$galleryContainer.html( '' ); 
1546			$title.html( this.title );
1547
1548			this.images.forEach( function( img ) {
1549				var $slide = $( slide );
1550				$slide.html( img );
1551				$galleryContainer.prepend( $slide );
1552			});
1553		},
1554
1555		showGallery : function() {
1556			var self = this;
1557
1558			this.$gallery.addClass( this.dom.activeClass );
1559
1560			utils.scroll.disable();
1561 
1562		},
1563
1564		removeGallery : function() {
1565			var self = this;
1566
1567			this.$gallery.removeClass( this.dom.activeClass );
1568
1569			setTimeout( function() {
1570				self.$gallery.remove();	
1571			}, 300 );
1572
1573			utils.scroll.enable();
1574		},
1575
1576		openByLink : function() {
1577			var loc = window.location,
1578				hash = loc.hash,
1579				id;
1580
1581			if ( hash.length && hash.substring(1).length ) {
1582				id = hash.substring(1);
1583				id = id.replace( '!loading', '' );
1584				if( id == this.id && !this.initialOpen ) {
1585					this.initialOpen = true;
1586					this.open();
1587				}
1588			}
1589		}
1590	};
1591
1592
1593	// Barts note; Rifat duplication and coupling here. Remove it when have time
1594	MK.component.PhotoAlbumBlur = function( el ) {
1595         var init = function(){
1596			core.loadDependencies([ path.plugins + 'pixastic.js' ], function() {
1597         		blurImage($('.mk-album-item figure')); 
1598         	});
1599         };
1600
1601         var blurImage = function($item) {
1602         	return $item.each(function() {
1603				var $_this = $(this);
1604				var img = $_this.find('.album-cover-image');
1605				img.clone().addClass("blur-effect item-blur-thumbnail").removeClass('album-cover-image').prependTo(this);
1606
1607				var blur_this = $(".blur-effect", this);
1608				blur_this.each(function(index, element){
1609					if (img[index].complete === true) {
1610						Pixastic.process(blur_this[index], "blurfast", {amount:0.5});
1611					}
1612					else {
1613						blur_this.load(function () {
1614							Pixastic.process(blur_this[index], "blurfast", {amount:0.5});
1615						});
1616					}
1617				});
1618			});
1619         };
1620
1621         return {
1622         	init : init
1623         };
1624    };
1625
1626})( jQuery );
1627jQuery(document).ready(function( $ ) {
1628
1629	// Continue only on Safari.
1630	if ( typeof window.safari === 'undefined' ) {
1631		return;
1632	}
1633
1634	// Fore redraw for Safari. This is a hack.
1635	function mkRedraw() {
1636		$('.mk-photo-roller').hide().show(0);
1637	}
1638
1639	mkRedraw();
1640
1641	$( window ).resize( function() {
1642		mkRedraw()
1643	} );
1644
1645});
1646jQuery(function($) {
1647
1648  'use strict';
1649
1650  // Get All Related Layers
1651  var init = function init() {
1652    var $portfolio = $('.portfolio-grid');
1653    var $imgs = $portfolio.find('img[data-mk-image-src-set]');
1654
1655    if ( $portfolio.hasClass('portfolio-grid-lazyload') && $imgs.length ) {
1656
1657      // Load Images if the user scrolls to them
1658      $(window).on('scroll.mk_portfolio_lazyload', MK.utils.throttle(500, function(){
1659        $imgs.each(function(index, elem) {
1660          if ( MK.utils.isElementInViewport(elem) ) {
1661            MK.component.ResponsiveImageSetter.init( $(elem) );
1662            $imgs = $imgs.not( $(elem) );  // Remove element from the list when loaded to reduce the amount of iteration in each()
1663          }
1664        });
1665      }));
1666
1667      $(window).trigger('scroll.mk_portfolio_lazyload');
1668
1669      // Handle the resize
1670      MK.component.ResponsiveImageSetter.onResize($imgs);
1671
1672    } else {
1673
1674      MK.component.ResponsiveImageSetter.init($imgs);
1675      MK.component.ResponsiveImageSetter.onResize($imgs);
1676
1677    }
1678  }
1679
1680  init();
1681  $(window).on('vc_reload', function(){
1682    init();
1683
1684    $('.mk-portfolio-container').each(function(){
1685      var id = $(this).attr('id');
1686      var el = '#' + id + '.mk-portfolio-container.js-el';
1687
1688      if($(this).data('mk-component') == 'Grid') {
1689        // Disable VC frontend component init for portfolio.
1690        $(el).data('init-Grid', true);
1691
1692        // Init Grid component on shortcode render.
1693        var component = new MK.component[ 'Grid' ]( el );
1694        component.init();
1695      }
1696    });
1697
1698  });
1699
1700});
1701
1702
1703
1704jQuery(document).ready(function($) {
1705    'use strict';
1706    /**
1707     * Get dynamic width of items for passing in `flexslider()`.
1708     * @param  string style      Style of the carousel, classic/modern
1709     * @param  integer showItems Number of items to show
1710     * @param  integer id        ID of the carousel
1711     * @return interger          The width for items
1712     */
1713    function get_item_width(style, showItems, id) {
1714        var item_width;
1715        if (style == "classic") {
1716            item_width = 275;
1717            items_to_show = 4;
1718        } else {
1719            var screen_width = $('#portfolio-carousel-' + id).width(),
1720                items_to_show = showItems;
1721            if (screen_width >= 1100) {
1722                item_width = screen_width / items_to_show;
1723            } else if (screen_width <= 1200 && screen_width >= 800) {
1724                item_width = screen_width / 3;
1725            } else if (screen_width <= 800 && screen_width >= 540) {
1726                item_width = screen_width / 2;
1727            } else {
1728                item_width = screen_width;
1729            }
1730        }
1731        return item_width;
1732    }
1733    jQuery(window).on("load vc_reload", function() {
1734        MK.core.loadDependencies([MK.core.path.plugins + 'jquery.flexslider.js'], function() {
1735
1736            $('.portfolio-carousel .mk-flexslider').each(function() {
1737            	var $this = $(this);
1738            	var $pauseOnHover = $this.attr('data-pauseOnHover') == "true" ? true : false;
1739
1740                $this.flexslider({
1741                    selector: ".mk-flex-slides > li",
1742                    slideshow: !isTest,
1743                    animation: "slide",
1744                    slideshowSpeed: parseInt($this.attr('data-slideshowSpeed')),
1745                    animationSpeed: parseInt($this.attr('data-animationSpeed')),
1746                    pauseOnHover: $pauseOnHover,
1747                    controlNav: false,
1748                    smoothHeight: false,
1749                    useCSS: false,
1750                    directionNav: $this.data('directionNav'),
1751                    prevText: "",
1752                    nextText: "",
1753                    itemWidth: get_item_width($this.data('style'), $this.data('showItems'), $this.data('id')),
1754                    itemMargin: 0,
1755                    maxItems: ($this.data('style') === 'modern') ? $this.data('showItems') : 4,
1756                    minItems: 1,
1757                    move: 1
1758                });
1759            }); // End each().
1760        }); // End loadDependencies().
1761    }); // End on().
1762});
1763(function( $ ) {
1764	'use strict';
1765
1766	var AjaxModal = function AjaxModal(el) {
1767		this.el = el;
1768
1769		var $this = $(el);
1770		var action = $this.data( 'action' );
1771		var id = $this.data( 'id' );
1772
1773		this.load(action, id);
1774	};
1775
1776	AjaxModal.prototype = {
1777		// TODO decouple this
1778		init: function init(html) {
1779			var self = this;
1780
1781			$('body').append( html );
1782
1783			this.cacheElements();
1784			this.bindEvents();
1785
1786			this.$modal.addClass( 'is-active' );
1787
1788			MK.core.initAll(self.$modal.get(0));
1789
1790			// Its used in Woocommerce Product variation script.
1791            $( '.variations_form' ).each( function() {
1792                $( this ).wc_variation_form().find('.variations select:eq(0)').change();
1793            });
1794
1795            MK.utils.scroll.disable();
1796			MK.ui.loader.remove();
1797			MK.utils.eventManager.publish('quickViewOpen');
1798		},
1799
1800		cacheElements: function cacheElement() {
1801			this.$modal = $('.mk-modal');
1802			this.$slider = this.$modal.find('.mk-slider-holder');
1803			this.$container = this.$modal.find('.mk-modal-container');
1804			this.$closeBtn = this.$modal.find('.js-modal-close');
1805		},
1806
1807		bindEvents: function bindEvents() {
1808			this.$container.on('click', function(e) {
1809				e.stopPropagation();
1810			});
1811
1812			this.$closeBtn.on('click', this.handleClose.bind(this));
1813			this.$modal.on('click', this.handleClose.bind(this));
1814		},
1815
1816		handleClose: function handleClose(e) {
1817			e.preventDefault();
1818			MK.utils.scroll.enable();
1819			this.close();
1820		},
1821
1822		close: function close() {
1823			this.$modal.remove();
1824		},
1825
1826		load: function load(action, id) {
1827			$.ajax({
1828				url: MK.core.path.ajaxUrl,
1829				data: {
1830					action: action,
1831					id: id
1832				},
1833				success: this.init.bind( this ),
1834				error: this.error.bind( this )
1835			});
1836		},
1837
1838		error: function error(response) {
1839			console.log(response);
1840		}
1841	};
1842
1843
1844	var createModal = function createModal(e) {
1845		e.preventDefault();
1846		var el = e.currentTarget;
1847		MK.ui.loader.add($(el).parents('.product-loop-thumb'));
1848		new AjaxModal(el);
1849	};
1850
1851
1852	$( document ).on( 'click', '.js-ajax-modal', createModal ); 
1853
1854	$(window).on('vc_reload', function(){
1855		$('.mk-product-loop').each(function(){
1856			var id = $(this).attr('id');
1857			var el = '#' + id + ' > .products.js-el';
1858
1859			// Disable VC frontend component init for products loop.
1860			$(el).data('init-Grid', true);
1861
1862			// Init Grid component on shortcode render.
1863			var component = new MK.component[ 'Grid' ]( el );
1864			component.init();
1865		});
1866	});
1867
1868})( jQuery );
1869
1870(function($) {
1871   if (window.addEventListener) {
1872      window.addEventListener('load', handleLoad, false);
1873    }
1874    else if (window.attachEvent) {
1875      window.attachEvent('onload', handleLoad);
1876    }
1877
1878	function handleLoad() {
1879		$('.mk-slideshow-box').each(run);
1880	}
1881
1882	function run() {
1883		var $slider = $(this);
1884
1885		var $slides = $slider.find('.mk-slideshow-box-item');
1886		var $transition_time = $slider.data('transitionspeed');
1887		var $time_between_slides = $slider.data('slideshowspeed');
1888
1889		$slider.find('.mk-slideshow-box-content').children('p').filter(function() {
1890			if ( $.trim($(this).text()) == '' ) {
1891				return true;
1892			}
1893		}).remove();
1894
1895		// set active classes
1896		$slides.first().addClass('active').fadeIn($transition_time, function(){
1897			setTimeout(autoScroll, $time_between_slides);
1898		});
1899
1900		// auto scroll
1901		function autoScroll(){
1902			if (isTest) return;
1903			var $i = $slider.find('.active').index();
1904			$slides.eq($i).removeClass('active').fadeOut($transition_time);
1905			if ($slides.length == $i + 1) $i = -1; // loop to start
1906			$slides.eq($i + 1).addClass('active').fadeIn($transition_time, function() {
1907				setTimeout(autoScroll, $time_between_slides);
1908			});
1909		}
1910
1911		/**
1912		 * Need to set the height manually as min-height property doesn't work with display
1913		 * table and table-cell in Firefox and Safari. We use Javascript to set them only
1914		 * for Firefox and Safari to avoid any problem with Chrome users. The problem is only
1915		 * happen when the window screen size bigger than 850px.
1916		 */
1917		var browserName  = MK.utils.browser.name;
1918		if ( browserName === 'Firefox' || browserName === 'Safari' ) {
1919			var currentWidth = parseInt( $( window ).width() );
1920			if ( currentWidth >= 850 ) {
1921				var height = $slider.css( 'min-height' );
1922				if ( typeof height !== 'undefined' ) {
1923					$slider.find( '.mk-slideshow-box-items' ).height( parseInt( height ) );
1924				}
1925			} else {
1926				$slider.find( '.mk-slideshow-box-items' ).removeAttr( 'style' );
1927			}
1928		}
1929	}
1930	$(window).on('vc_reload', function(){
1931		handleLoad();
1932	});
1933
1934	// Handle resize event only for Safari and Firefox.
1935	window.addEventListener( 'resize', function(){
1936		var browserName  = MK.utils.browser.name;
1937		if ( browserName === 'Firefox' || browserName === 'Safari' ) {
1938			handleLoad();
1939		}
1940	}, true);
1941}(jQuery));
1942(function($) {
1943	'use strict';
1944
1945	$(".mk-subscribe").each(function() {
1946		var $this = $(this);
1947		
1948		$this.find('.mk-subscribe--form').submit(function(e){
1949			e.preventDefault();
1950			$.ajax({
1951				url: MK.core.path.ajaxUrl,
1952				type: "POST",
1953				data: {
1954					action: "mk_ajax_subscribe",
1955					email: $this.find(".mk-subscribe--email").val(),
1956					list_id: $this.find(".mk-subscribe--list-id").val(),
1957					optin: $this.find(".mk-subscribe--optin").val()
1958				},
1959				success: function (res) {
1960					$this.find(".mk-subscribe--message").html($.parseJSON(res).message);
1961					console.log($.parseJSON(res).message);
1962				}
1963			});
1964		});
1965	});
1966
1967}(jQuery));
1968(function( $ ) {
1969    'use strict';
1970
1971    // If we want to get access to API of already initilised component we run a regular new conctructor.
1972    // When instance is discovered in cache object then we return exisiting instance.
1973    // 
1974    // TODO move it to core functions and run logic on init
1975    // var init = function init() {
1976    var _instancesCollection = {};
1977
1978    MK.component.SwipeSlideshow = function( el ) {
1979        var $this = $( el );
1980        var id = $this.parent().attr('id');
1981
1982        this.el = el;
1983        this.id = id;
1984        this.config = $this.data( 'swipeslideshow-config' );
1985        if( this.config ) this.config.hasPagination = false;
1986    };
1987
1988    MK.component.SwipeSlideshow.prototype = {
1989        init : function() {
1990            var slider = new MK.ui.Slider( this.el, this.config );
1991            slider.init();
1992
1993            _instancesCollection[ this.id ] = slider;
1994        }
1995    };
1996
1997
1998    // Additional nav
1999    // Mostly for thumbs in woocommerce
2000    MK.component.SwipeSlideshowExtraNav = function( el ) {
2001        this.el = el;
2002    };
2003
2004    MK.component.SwipeSlideshowExtraNav.prototype = {
2005        init : function init() {
2006            this.cacheElements();
2007            this.bindEvents();
2008        },
2009
2010        cacheElements : function cacheElements() {
2011            var $this = $( this.el );
2012
2013            this.sliderId = $this.data( 'gallery' );
2014            this.slider = _instancesCollection[this.sliderId]; 
2015            this.$thumbs = $( '#' + this.sliderId ).find( '.thumbnails a');
2016        },
2017
2018        bindEvents : function bindEvents() {
2019            this.$thumbs.on( 'click', this.clickThumb.bind( this ) );
2020        },
2021
2022        clickThumb : function clickThumb( e ) {
2023            e.preventDefault();
2024            var $this = $( e.currentTarget ),
2025                id = $this.index();
2026
2027            this.slider.goTo( id );
2028        }
2029    };
2030
2031
2032    // Mostly for switcher in woocommerce
2033    MK.utils.eventManager.subscribe('gallery-update', function(e, config) {
2034        if(typeof _instancesCollection[config.id] === 'undefined') return;
2035        _instancesCollection[config.id].reset();
2036    });
2037
2038	function init() {
2039		// Lazy load.
2040		// Get All Related Layers
2041		var $swiper = $('.mk-swipe-slideshow');
2042		var $imgs = $swiper.find('img[data-mk-image-src-set]');
2043
2044		if ( $swiper.hasClass('mk-swipe-slideshow-lazyload') && $imgs.length ) {
2045
2046			// Load Images if the user scrolls to them
2047			$(window).on('scroll.mk_swipe_slideshow_lazyload', MK.utils.throttle(500, function(){
2048				$imgs.each(function(index, elem) {
2049					if ( MK.utils.isElementInViewport(elem) ) {
2050						MK.component.ResponsiveImageSetter.init( $(elem) );
2051						$imgs = $imgs.not( $(elem) );  // Remove element from the list when loaded to reduce the amount of iteration in each()
2052					}
2053				});
2054			}));
2055
2056			$(window).trigger('scroll.mk_swipe_slideshow_lazyload');
2057
2058			// Handle the resize
2059			MK.component.ResponsiveImageSetter.onResize($imgs);
2060
2061		} else {
2062
2063			MK.component.ResponsiveImageSetter.init($imgs);
2064			MK.component.ResponsiveImageSetter.onResize($imgs);
2065
2066		}
2067		
2068        /* Why we need to reinitialize it? it causes double sliding effect
2069    		$( '.mk-swiper-container' ).each( function() {
2070    			new MK.component.SwipeSlideshow( this ).init();
2071    		} );
2072        */
2073	}
2074
2075	init();
2076	$(window).on('vc_reload', init);
2077
2078})( jQuery );
2079(function($) {
2080    'use strict';
2081
2082    var core = MK.core,
2083        path = core.path;
2084
2085    MK.component.Tooltip = function(el) {
2086        var init = function() {
2087             $('.mk-tooltip').each(function() {
2088                $(this).find('.mk-tooltip--link').hover(function() {
2089                  $(this).siblings('.mk-tooltip--text').stop(true).animate({
2090                    'opacity': 1
2091                  }, 400);
2092
2093                }, function() {
2094                  $(this).siblings('.mk-tooltip--text').stop(true).animate({
2095                    'opacity': 0
2096                  }, 400);
2097                });
2098              });
2099        };
2100
2101        return {
2102            init: init
2103        };
2104    };
2105
2106})(jQuery);
2107
2108(function( $ ) {
2109	'use strict';
2110
2111	/**
2112	 * Fix issue with WC Recent Carousel classic style when SC is active.
2113	 * At the first load of shortcode, the height is not correct, only cover the image
2114	 * without product detail. This script only set the min-height.
2115	 */
2116	function mkWcCarouselSwiperHeight() {
2117		var mkWCRecentCarousel = $( '.mk-woocommerce-carousel.classic-style' );
2118		mkWCRecentCarousel.each( function() {
2119			var maxHeight = 0;
2120			var height = $( this ).height();
2121			var childs = $( this ).find( '.item' );
2122			childs.each( function(){
2123				if ( $( this ).height() > maxHeight ) {
2124					maxHeight = $( this ).height();
2125				}
2126			} );
2127			var swiperContainers = $( this ).find( '.mk-swiper-container' );
2128			swiperContainers[0].style.setProperty( 'min-height', maxHeight + 'px', 'important' );
2129		} );
2130	}
2131
2132	mkWcCarouselSwiperHeight();
2133
2134}
2134)( jQuery );
2135(function ($) {
2136	'use strict';  
2137
2138	function dynamicHeight() {
2139		var $this = $( this );
2140
2141		$this.height( 'auto' );
2142
2143		if( window.matchMedia( '(max-width: 768px)' ).matches ) {
2144			return;
2145		} 
2146		 
2147		$this.height( $this.height() );
2148	}
2149
2150	var $window = $( window );
2151	var container = document.getElementById( 'mk-theme-container' );
2152
2153	function equalColumns() {
2154		$( '.equal-columns' ).each( function() { 
2155			dynamicHeight.bind( this );
2156		    $window.on( 'load', dynamicHeight.bind( this ) );
2157		    $window.on( 'resize', dynamicHeight.bind( this ) );
2158		    window.addResizeListener( container, dynamicHeight.bind( this ) );
2159		});
2160	}
2161	equalColumns();
2162	$window.on( 'vc_reload' , function() {
2163		equalColumns();
2164	});
2165
2166}( jQuery ));
2167(function($) {
2168	'use strict';
2169
2170	function mk_video_play() {
2171
2172		var lightboxMargin = 60;
2173
2174		// Play self hosted video
2175		function playSelfHosted($video, isLightbox) {
2176			if (isLightbox === undefined || typeof isLightbox === 'undefined') {
2177				isLightbox = false;
2178			}
2179
2180			if (isLightbox) {
2181
2182				var content = $video.parent().html();
2183
2184				playLightbox({
2185					content: '<div class="fancybox-video">' + $(content).attr('autoplay', 'autoplay').wrap('<div></div>').parent().html() + '</div>',
2186				});
2187
2188			} else {
2189				playTagVideo($video);
2190			}
2191		}
2192
2193		// Play social hosted video
2194		function playSocialHosted($iframe, isLightbox) {
2195
2196			if (isLightbox === undefined || typeof isLightbox === 'undefined') {
2197				isLightbox = false;
2198			}
2199
2200			if (isLightbox) {
2201
2202				playLightbox({
2203					type: 'iframe',
2204					href: $iframe.attr('src'),
2205					helpers: {
2206						media: true
2207					}
2208				});
2209
2210			} else {
2211
2212				var videoData = getSocialVideoData($iframe.attr('src'));
2213
2214				switch (videoData.source) {
2215					case 'youtube':
2216						playTagIframeYoutube(videoData.videoId, $iframe);
2217						break;
2218					case 'vimeo':
2219						playTagIframeVimeo(videoData.videoId, $iframe);
2220						break;
2221					default:
2222						playTagIframe($iframe);
2223						break;
2224				}
2225			}
2226		}
2227
2228		// Play video in lightbox
2229		function playLightbox(args) {
2230			var options = {
2231				padding: 0,
2232				margin: lightboxMargin,
2233				showCloseButton: 1,
2234				autoSize: 0,
2235				width: getVideoboxWidth(),
2236				height: getVideoHeight(),
2237				tpl: {
2238					closeBtn: '<a title="Close" class="fancybox-item fancybox-close fancybox-video-close" href="javascript:;"></a>',
2239				},
2240			};
2241			$.extend(options, args);
2242			$.fancybox.open(options);
2243		}
2244
2245		function playTagVideo($video) {
2246			$video.get(0).play();
2247			$video.closest('.video-container').find('.video-thumbnail').fadeOut('slow');
2248		}
2249
2250		function playTagIframe($iframe, videoId) {
2251			var video_loop = '';
2252			if (videoId !== undefined && typeof videoId !== 'undefined') {
2253				video_loop = '&playlist=' + videoId;
2254			}
2255
2256			var src = $iframe.attr('src');
2257			var separator = (src.indexOf('?') === -1) ? '?' : '&';
2258			src += separator + 'autoplay=1';
2259			separator = (src.indexOf('?') === -1) ? '?' : '&';
2260			video_loop = separator + 'loop=1' + video_loop;
2261			video_loop = ( $iframe.closest('.video-container').data('loop') == '1' ) ? video_loop : '';
2262			src += video_loop;
2263			$iframe.attr('src', src).closest('.video-container').find('.video-thumbnail').fadeOut(3000);
2264		}
2265
2266		function playTagIframeYoutube(videoId, $iframe) {
2267
2268			// Credit: https://goo.gl/ku3NgH
2269			if ( document.getElementById('mk_iframe_api') === null ) {
2270				var tag = document.createElement('script');
2271				tag.src = "https://www.youtube.com/iframe_api";
2272				tag.id = "mk_iframe_api";
2273				var firstScriptTag = document.getElementsByTagName('script')[0];
2274				firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
2275			} else {
2276				runPlayer();
2277			}
2278
2279			window.onYouTubeIframeAPIReady = function () {
2280				runPlayer();
2281			};
2282
2283			function runPlayer(){
2284				var player,
2285					isPlayed = false;
2286
2287				player = new YT.Player('video-player-' + $iframe.data('id'), {
2288					videoId: videoId,
2289					rel: false,
2290					events: {
2291						onReady: function(e) {
2292							e.target.playVideo();
2293						},
2294						onStateChange: function(e) {
2295							if (e.data === 1 && !isPlayed) {
2296								$(e.target.a).closest('.video-container').find('.video-thumbnail').fadeOut('slow');
2297								isPlayed = true;
2298							}
2299
2300							if ($(e.target.a).closest('.video-container').data('loop') && e.data === YT.PlayerState.ENDED) {
2301								e.target.playVideo();
2302							}
2303						},
2304						onError: function(e) {
2305							playTagIframe($iframe, videoId);
2306						}
2307					}
2308				});
2309			}
2310		}
2311
2312		function playTagIframeVimeo(videoId, $iframe) {
2313			// Embed async the vimeo API script
2314			$.getScript('//player.vimeo.com/api/player.js', function(data, textStatus, jqxhr) {
2315				if (jqxhr.status === 200) {
2316
2317					var player,
2318						isPlayed = false;
2319
2320					player = new Vimeo.Player('video-player-' + $iframe.data('id'), {
2321						id: videoId
2322					});
2323
2324					player.play().then(function() {
2325						if (!isPlayed) {
2326							$iframe.closest('.video-container').find('.video-thumbnail').fadeOut('slow');
2327							isPlayed = true;
2328						}
2329					}).catch(function(error) {
2330						playTagIframe($iframe);
2331					});
2332
2333					if ($iframe.closest('.video-container').data('loop')) {
2334						player.setLoop(true).then(function(loop) {
2335							// Enable loop
2336						}).catch(function(error) {
2337							playTagIframe($iframe);
2338						});
2339					}
2340
2341				} else {
2342					playTagIframe($iframe);
2343				}
2344			});
2345		}
2346
2347		// Get Social Provider Video Data
2348		function getSocialVideoData(url) {
2349
2350			// Get Youtube video data
2351			var youtubeRegex = /(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i;
2352			var youtubeMatch = url.match(youtubeRegex);
2353			if (youtubeMatch && youtubeMatch != null) {
2354				return {
2355					source: 'youtube',
2356					videoId: youtubeMatch[3]
2357				};
2358			}
2359
2360			// Get Vimeo video data
2361			var vimeoRegex = /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/i;
2362			var vimeoMatch = url.match(vimeoRegex);
2363			if (vimeoMatch && vimeoMatch != null) {
2364				return {
2365					source: 'vimeo',
2366					videoId: vimeoMatch[1]
2367				};
2368			}
2369
2370			return {
2371				source: false,
2372				videoId: false
2373			};
2374		}
2375
2376		// Get lightbox width
2377		function getVideoboxWidth() {
2378			var $width,
2379				wWidth = $(window).width(),
2380				wHeight = $(window).height();
2381
2382			if (wHeight >= wWidth) {
2383
2384				$width = wWidth - (lightboxMargin * 2);
2385
2386			} else {
2387
2388				var wHeightMax = (wHeight * 90) / 100;
2389
2390				if (wWidth > 1280) {
2391					var $width = (wHeightMax / 5768) * 10000;
2392				} else {
2393					var $width = (wHeightMax / 6120) * 10000;
2394				}
2395
2396			}
2397
2398			return Math.round($width) + 'px';
2399		}
2400
2401		// Get lightbox height
2402		function getVideoHeight() {
2403
2404			var $height,
2405				wWidth = $(window).width(),
2406				wHeight = $(window).height();
2407
2408			if (wHeight >= wWidth) {
2409				$height = ((wWidth - (lightboxMargin * 2)) * 5670) / 10000;
2410			} else {
2411				$height = ((wHeight * 90) / 100) + (lightboxMargin * 2);
2412			}
2413			return Math.round($height) + 'px';
2414		}
2415
2416		$('.video-container').each(function() {
2417
2418			var $videoContainer = $(this);
2419			var playSource = $videoContainer.data('source');
2420			var playTarget = $videoContainer.data('target');
2421			var $iframe = $videoContainer.find('iframe');
2422			var $video = $videoContainer.find('video');
2423
2424			if ($videoContainer.data('autoplay')) {
2425				switch (playSource) {
2426					case 'social_hosted':
2427						playSocialHosted($iframe);
2428						break;
2429					case 'self_hosted':
2430						playSelfHosted($video);
2431						break;
2432				}
2433			} else {
2434				var $playIcon = $videoContainer.find('.mk-svg-icon');
2435				$playIcon.bind('click', function(e) {
2436					e.preventDefault();
2437					var isLightbox = (playTarget == 'lightbox') ? true : false;
2438					if (!isLightbox) {
2439						$playIcon.hide().next('.preloader-preview-area').show();
2440					}
2441					switch (playSource) {
2442						case 'social_hosted':
2443							playSocialHosted($iframe, isLightbox);
2444							break;
2445						case 'self_hosted':
2446							playSelfHosted($video, isLightbox);
2447							break;
2448					}
2449				});
2450			}
2451		});
2452	}
2453	$(window).on('load vc_reload', mk_video_play);
2454
2455	// Resize icon size for responsive layout
2456	function mk_video_resize_play_icon() {
2457		$('.video-thumbnail-overlay').each(function() {
2458			var $thumbnailOverlay = $(this);
2459			var thumbnailWidth = $thumbnailOverlay.width();
2460			var $svg = $thumbnailOverlay.find('svg');
2461			if (typeof $svg.data('width') === 'undefined') {
2462				$svg.attr('data-width', $svg.width());
2463			}
2464			if (typeof $svg.data('height') === 'undefined') {
2465				$svg.attr('data-height', $svg.height());
2466			}
2467			if (($svg.data('width') * 4) > thumbnailWidth) {
2468				$svg.css({
2469					width: Math.round((parseInt(thumbnailWidth) / 4)) + 'px',
2470					height: Math.round((parseInt(thumbnailWidth) / 4) * $svg.data('height') / $svg.data('width')) + 'px'
2471				});
2472			} else {
2473				$svg.css({
2474					width: $svg.data('width') + 'px',
2475					height: $svg.data('height') + 'px'
2476				});
2477			}
2478		});
2479	}
2480	$(window).on('load resize orientationChange vc_reload', mk_video_resize_play_icon);
2481}(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.