PageSourceSearch

https://supersometimes.com/wp-content/themes/piquant/assets/js/modules.js?ver=7.1.2

js supersometimes.com collected 2026-10-04 22:00:03 UTC 148,072 bytes, 3,750 lines download raw bytes

1(function($) {
2    "use strict";
3
4    window.mkdf = {};
5    mkdf.modules = {};
6
7    mkdf.scroll = 0;
8    mkdf.window = $(window);
9    mkdf.document = $(document);
10    mkdf.windowWidth = $(window).width();
11    mkdf.windowHeight = $(window).height();
12    mkdf.body = $('body');
13    mkdf.html = $('html, body');
14    mkdf.htmlEl = $('html');
15    mkdf.menuDropdownHeightSet = false;
16    mkdf.defaultHeaderStyle = '';
17    mkdf.minVideoWidth = 1500;
18    mkdf.videoWidthOriginal = 1280;
19    mkdf.videoHeightOriginal = 720;
20    mkdf.videoRatio = 1280/720;
21
22    //set boxed layout width variable for various calculations
23
24    switch(true){
25        case mkdf.body.hasClass('mkdf-grid-1300'):
26            mkdf.boxedLayoutWidth = 1350;
27            break;
28        case mkdf.body.hasClass('mkdf-grid-1200'):
29            mkdf.boxedLayoutWidth = 1250;
30            break;
31        case mkdf.body.hasClass('mkdf-grid-1000'):
32            mkdf.boxedLayoutWidth = 1050;
33            break;
34        case mkdf.body.hasClass('mkdf-grid-800'):
35            mkdf.boxedLayoutWidth = 850;
36            break;
37        default :
38            mkdf.boxedLayoutWidth = 1150;
39            break;
40    }
41    
42    $(document).ready(function(){
43        mkdf.scroll = $(window).scrollTop();
44
45        //set global variable for header style which we will use in various functions
46        if(mkdf.body.hasClass('mkdf-dark-header')){ mkdf.defaultHeaderStyle = 'mkdf-dark-header';}
47        if(mkdf.body.hasClass('mkdf-light-header')){ mkdf.defaultHeaderStyle = 'mkdf-light-header';}
48
49    });
50
51
52    $(window).resize(function() {
53        mkdf.windowWidth = $(window).width();
54        mkdf.windowHeight = $(window).height();
55    });
56
57
58    $(window).scroll(function(){
59        mkdf.scroll = $(window).scrollTop();
60    });
61
62
63
64})(jQuery);
65(function($) {
66	"use strict";
67
68    var common = {};
69    mkdf.modules.common = common;
70
71    common.mkdfFluidVideo = mkdfFluidVideo;
72    common.mkdfPreloadBackgrounds = mkdfPreloadBackgrounds;
73    common.mkdfPrettyPhoto = mkdfPrettyPhoto;
74    common.mkdfCheckHeaderStyleOnScroll = mkdfCheckHeaderStyleOnScroll;
75    common.mkdfInitParallax = mkdfInitParallax;
76    common.mkdfSmoothScroll = mkdfSmoothScroll;
77    common.mkdfEnableScroll = mkdfEnableScroll;
78    common.mkdfDisableScroll = mkdfDisableScroll;
79    common.mkdfWheel = mkdfWheel;
80    common.mkdfKeydown = mkdfKeydown;
81    common.mkdfPreventDefaultValue = mkdfPreventDefaultValue;
82    common.mkdfOwlSlider = mkdfOwlSlider;
83    common.mkdfInitSelfHostedVideoPlayer = mkdfInitSelfHostedVideoPlayer;
84    common.mkdfSelfHostedVideoSize = mkdfSelfHostedVideoSize;
85    common.mkdfInitBackToTop = mkdfInitBackToTop;
86    common.mkdfBackButtonShowHide = mkdfBackButtonShowHide;
87    
88
89	$(document).ready(function() {
90		mkdfFluidVideo();
91        mkdfPreloadBackgrounds();
92        mkdfPrettyPhoto();
93        mkdfInitElementsAnimations();
94        mkdfInitAnchor().init();
95        mkdfInitVideoBackground();
96        mkdfInitVideoBackgroundSize();
97        mkdfSetContentBottomMargin();
98        mkdfSmoothScroll();
99        mkdfOwlSlider();
100        mkdfInitSelfHostedVideoPlayer();
101		mkdfSelfHostedVideoSize();
102        mkdfInitBackToTop();
103        mkdfBackButtonShowHide();
104	});
105
106    $(window).on('load', function() {
107        mkdfCheckHeaderStyleOnScroll(); //called on load since all content needs to be loaded in order to calculate row's position right
108        mkdfInitParallax();
109    });
110
111	$(window).resize(function() {
112		mkdfInitVideoBackgroundSize();
113		mkdfSelfHostedVideoSize();
114	});
115
116	function mkdfFluidVideo() {
117        fluidvids.init({
118			selector: ['iframe'],
119			players: ['www.youtube.com', 'player.vimeo.com']
120		});
121	}
122
123    /**
124     * Init Owl Carousel
125     */
126    function mkdfOwlSlider() {
127
128        var sliders = $('.mkdf-owl-slider');
129
130        if (sliders.length) {
131            sliders.each(function(){
132
133                var slider = $(this);
134                slider.owlCarousel({
135                    singleItem: true,
136                    navigation: true,
137                    autoHeight: true,
138                    pagination: false,
139                    slideSpeed: 600,
140                    navigationText: [
141                        '<span class="mkdf-prev-icon"><span aria-hidden="true" class="arrow_carrot-left"></span></span>',
142                        '<span class="mkdf-next-icon"><span aria-hidden="true" class="arrow_carrot-right"></span></span>'
143                    ]
144                });
145
146            });
147        }
148
149    }
150
151
152    /*
153     *	Preload background images for elements that have 'mkdf-preload-background' class
154     */
155    function mkdfPreloadBackgrounds(){
156
157        $(".mkdf-preload-background").each(function() {
158            var preloadBackground = $(this);
159            if(preloadBackground.css("background-image") !== "" && preloadBackground.css("background-image") != "none") {
160
161                var bgUrl = preloadBackground.attr('style');
162
163                bgUrl = bgUrl.match(/url\(["']?([^'")]+)['"]?\)/);
164                bgUrl = bgUrl ? bgUrl[1] : "";
165
166                if (bgUrl) {
167                    var backImg = new Image();
168                    backImg.src = bgUrl;
169                    $(backImg).load(function(){
170                        preloadBackground.removeClass('mkdf-preload-background');
171                    });
172                }
173            }else{
174                $(window).on('load', function(){ preloadBackground.removeClass('mkdf-preload-background'); }); //make sure that mkdf-preload-background class is removed from elements with forced background none in css
175            }
176        });
177    }
178
179    function mkdfPrettyPhoto() {
180        var markupWhole = '<div class="pp_pic_holder"> \
181                        <div class="ppt">&nbsp;</div> \
182                        <div class="pp_top"> \
183                            <div class="pp_left"></div> \
184                            <div class="pp_middle"></div> \
185                            <div class="pp_right"></div> \
186                        </div> \
187                        <div class="pp_content_container"> \
188                            <div class="pp_left"> \
189                            <div class="pp_right"> \
190                                <div class="pp_content"> \
191                                    <div class="pp_loaderIcon"></div> \
192                                    <div class="pp_fade"> \
193                                        <a href="#" class="pp_expand" title="Expand the image">Expand</a> \
194                                        <div class="pp_hoverContainer"> \
195                                            <a class="pp_next" href="#"><span aria-hidden="true" class="arrow_carrot-right"></span></a> \
196                                            <a class="pp_previous" href="#"><span aria-hidden="true" class="arrow_carrot-left"></span></a> \
197                                        </div> \
198                                        <div id="pp_full_res"></div> \
199                                        <div class="pp_details"> \
200                                            <div class="pp_nav"> \
201                                                <a href="#" class="pp_arrow_previous">Previous</a> \
202                                                <p class="currentTextHolder">0/0</p> \
203                                                <a href="#" class="pp_arrow_next">Next</a> \
204                                            </div> \
205                                            <p class="pp_description"></p> \
206                                            {pp_social} \
207                                            <a class="pp_close" href="#"><span aria-hidden="true" class="icon_close"></span></a> \
208                                        </div> \
209                                    </div> \
210                                </div> \
211                            </div> \
212                            </div> \
213                        </div> \
214                        <div class="pp_bottom"> \
215                            <div class="pp_left"></div> \
216                            <div class="pp_middle"></div> \
217                            <div class="pp_right"></div> \
218                        </div> \
219                    </div> \
220                    <div class="pp_overlay"></div>';
221
222        $("a[data-rel^='prettyPhoto']").prettyPhoto({
223            hook: 'data-rel',
224            animation_speed: 'normal', /* fast/slow/normal */
225            slideshow: false, /* false OR interval time in ms */
226            autoplay_slideshow: false, /* true/false */
227            opacity: 0.80, /* Value between 0 and 1 */
228            show_title: true, /* true/false */
229            allow_resize: true, /* Resize the photos bigger than viewport. true/false */
230            horizontal_padding: 0,
231            default_width: 960,
232            default_height: 540,
233            counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
234            theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
235            hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
236            wmode: 'opaque', /* Set the flash wmode attribute */
237            autoplay: true, /* Automatically start videos: True/False */
238            modal: false, /* If set to true, only the close button will close the window */
239            overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
240            keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
241            deeplinking: false,
242            custom_markup: '',
243            social_tools: false,
244            markup: markupWhole
245        });
246    }
247
248    /*
249     *	Check header style on scroll, depending on row settings
250     */
251    function mkdfCheckHeaderStyleOnScroll(){
252
253        if($('[data-mkdf_header_style]').length >
253 0 && mkdf.body.hasClass('mkdf-header-style-on-scroll')) {
254
255            var waypointSelectors = $('.mkdf-full-width-inner > .wpb_row.mkdf-section, .mkdf-full-width-inner > .mkdf-parallax-section-holder, .mkdf-container-inner > .wpb_row.mkdf-section, .mkdf-container-inner > .mkdf-parallax-section-holder, .mkdf-portfolio-single > .wpb_row.mkdf-section');
256            var changeStyle = function(element){
257                (element.data("mkdf_header_style") !== undefined) ? mkdf.body.removeClass('mkdf-dark-header mkdf-light-header').addClass(element.data("mkdf_header_style")) : mkdf.body.removeClass('mkdf-dark-header mkdf-light-header').addClass(''+mkdf.defaultHeaderStyle);
258            };
259
260            waypointSelectors.waypoint( function(direction) {
261                if(direction === 'down') { changeStyle($(this.element)); }
262            }, { offset: 0});
263
264            waypointSelectors.waypoint( function(direction) {
265                if(direction === 'up') { changeStyle($(this.element)); }
266            }, { offset: function(){
267                return -$(this.element).outerHeight();
268            } });
269        }
270    }
271
272    /*
273     *	Start animations on elements
274     */
275    function mkdfInitElementsAnimations(){
276
277        var touchClass = $('.mkdf-no-animations-on-touch'),
278            noAnimationsOnTouch = true,
279            elements = $('.mkdf-grow-in, .mkdf-fade-in-down, .mkdf-element-from-fade, .mkdf-element-from-left, .mkdf-element-from-right, .mkdf-element-from-top, .mkdf-element-from-bottom, .mkdf-flip-in, .mkdf-x-rotate, .mkdf-z-rotate, .mkdf-y-translate, .mkdf-fade-in, .mkdf-fade-in-left-x-rotate'),
280            animationClass,
281			animationData;
282
283        if (touchClass.length) {
284            noAnimationsOnTouch = false;
285        }
286
287        if(elements.length > 0 && noAnimationsOnTouch){
288            elements.each(function(){
289                $(this).appear(function() {
290					animationData = $(this).data('animation');
291                    if(typeof animationData !== 'undefined' && animationData !== '') {
292						animationClass = animationData;
293						$(this).addClass(animationClass+'-on');
294					}
295
296                },{accX: 0, accY: mkdfGlobalVars.vars.mkdfElementAppearAmount});
297            });
298        }
299
300    }
301
302
303/*
304 **	Sections with parallax background image
305 */
306function mkdfInitParallax(){
307
308    if($('.mkdf-parallax-section-holder').length){
309        $('.mkdf-parallax-section-holder').each(function() {
310
311            var parallaxElement = $(this);
312            if(parallaxElement.hasClass('mkdf-full-screen-height-parallax')){
313                parallaxElement.height(mkdf.windowHeight);
314                parallaxElement.find('.mkdf-parallax-content-outer').css('padding',0);
315            }
316            var speed = parallaxElement.data('mkdf-parallax-speed')*0.4;
317            parallaxElement.parallax("50%", speed);
318        });
319    }
320}
321
322/*
323 **	Anchor functionality
324 */
325var mkdfInitAnchor = mkdf.modules.common.mkdfInitAnchor = function() {
326
327    /**
328     * Set active state on clicked anchor
329     * @param anchor, clicked anchor
330     */
331    var setActiveState = function(anchor){
332
333        $('.mkdf-main-menu .mkdf-active-item, .mkdf-mobile-nav .mkdf-active-item, .mkdf-vertical-menu .mkdf-active-item').removeClass('mkdf-active-item');
334        anchor.parent().addClass('mkdf-active-item');
335
336        $('.mkdf-main-menu a, .mkdf-mobile-nav a, .mkdf-vertical-menu a').removeClass('current');
337        anchor.addClass('current');
338    };
339
340    /**
341     * Check anchor active state on scroll
342     */
343    var checkActiveStateOnScroll = function(){
344
345        $('[data-mkdf-anchor]').waypoint( function(direction) {
346            if(direction === 'down') {
347                setActiveState($("a[href='"+window.location.href.split('#')[0]+"#"+$(this.element).data("mkdf-anchor")+"']"));
348            }
349        }, { offset: '50%' });
350
351        $('[data-mkdf-anchor]').waypoint( function(direction) {
352            if(direction === 'up') {
353                setActiveState($("a[href='"+window.location.href.split('#')[0]+"#"+$(this.element).data("mkdf-anchor")+"']"));
354            }
355        }, { offset: function(){
356            return -($(this.element).outerHeight() - 150);
357        } });
358
359    };
360
361    /**
362     * Check anchor active state on load
363     */
364    var checkActiveStateOnLoad = function(){
365        var hash = window.location.hash.split('#')[1];
366
367        if(hash !== "" && $('[data-mkdf-anchor="'+hash+'"]').length > 0){
368            //triggers click which is handled in 'anchorClick' function
369            $("a[href='"+window.location.href.split('#')[0]+"#"+hash).trigger( "click" );
370        }
371    };
372
373    /**
374     * Calculate header height to be substract from scroll amount
375     * @param anchoredElementOffset, anchorded element offest
376     */
377    var headerHeihtToSubtract = function(anchoredElementOffset){
378
379        if(mkdf.modules.header.behaviour == 'mkdf-sticky-header-on-scroll-down-up') {
380            (anchoredElementOffset > mkdf.modules.header.stickyAppearAmount) ? mkdf.modules.header.isStickyVisible = true : mkdf.modules.header.isStickyVisible = false;
381        }
382
383        if(mkdf.modules.header.behaviour == 'mkdf-sticky-header-on-scroll-up') {
384            (anchoredElementOffset > mkdf.scroll) ? mkdf.modules.header.isStickyVisible = false : '';
385        }
386
387        var headerHeight = mkdf.modules.header.isStickyVisible ? mkdfGlobalVars.vars.mkdfStickyHeaderTransparencyHeight : mkdfPerPageVars.vars.mkdfHeaderTransparencyHeight;
388
389        return headerHeight;
390    };
391
392    /**
393     * Handle anchor click
394     */
395    var anchorClick = function() {
396        mkdf.document.on("click", ".mkdf-main-menu a, .mkdf-vertical-menu a, .mkdf-btn, .mkdf-anchor, .mkdf-mobile-nav a", function() {
397			console.log('here');
398            var scrollAmount;
399            var anchor = $(this);
400            var hash = anchor.prop("hash").split('#')[1];
401
402            if(hash !== "" && $('[data-mkdf-anchor="' + hash + '"]').length > 0 && anchor.attr('href').split('#')[0] == window.location.href.split('#')[0]) {
403
404                var anchoredElementOffset = $('[data-mkdf-anchor="' + hash + '"]').offset().top;
405                scrollAmount = $('[data-mkdf-anchor="' + hash + '"]').offset().top - headerHeihtToSubtract(anchoredElementOffset);
406
407                setActiveState(anchor);
408
409                mkdf.html.stop().animate({
410                    scrollTop: Math.round(scrollAmount)
411                }, 1000, function() {
412                    //change hash tag in url
413                    if(history.pushState) { history.pushState(null, null, '#'+hash); }
414                });
415                return false;
416            }
417        });
418    };
419
420    return {
421        init: function() {
422            if($('[data-mkdf-anchor]').length) {
423                anchorClick();
424                checkActiveStateOnScroll();
425                $(window).on('load', function() { checkActiveStateOnLoad(); });
426            }
427        }
428    };
429
430};
431
432/*
433 **	Video background initialization
434 */
435function mkdfInitVideoBackground(){
436
437    $('.mkdf-section .mkdf-video-wrap .mkdf-video').mediaelementplayer({
438        enableKeyboard: false,
439        iPadUseNativeControls: false,
440        pauseOtherPlayers: false,
441        // force iPhone's native controls
442        iPhoneUseNativeControls: false,
443        // force Android's native controls
444        AndroidUseNativeControls: false
445    });
446
447    //mobile check
448    if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
449        mkdfInitVideoBackgroundSize();
450        $('.mkdf-section .mkdf-mobile-video-image').show();
451        $('.mkdf-section .mkdf-video-wrap').remove();
452    }
453}
454
455    /*
456     **	Calculate video background size
457     */
458    function mkdfInitVideoBackgroundSize(){
459
460        $('.mkdf-section .mkdf-video-wrap').each(function(){
461
462            var element = $(this);
463            var sectionWidth = element.closest('.mkdf-section').outerWidth();
464            element.width(sectionWidth);
465
466            var sectionHeight = element.closest('.mkdf-section').outerHeight();
467            mkdf.minVideoWidth = mkdf.videoRatio * (sectionHeight+20);
468            element.height(sectionHeight);
469
470            var scaleH = sectionWidth / mkdf.videoWidthOriginal;
471            var scaleV = sectionHeight / mkdf.videoHeightOriginal;
472            var scale =  scaleV;
473            if (scaleH > scaleV)
474                scale =  scaleH;
475            if (scale * mkdf.videoWidthOriginal < mkdf.minVideoWidth) {scale = mkdf.minVideoWidth / mkdf.videoWidthOriginal;}
476
477            element.find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * mkdf.videoWidthOriginal +2));
478            element.find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * mkdf.videoHeightOriginal +2));
479            element.scrollLeft((element.find('video').width() - sectionWidth) / 2);
480            element.find('.mejs-overlay, .mejs-poster').scrollTop((element.find('video').height() - (sectionHeight)) / 2);
481            element.scrollTop((element.find('video').height() - sectionHeight) / 2);
482        });
483
484    }
485
486    /*
487     **	Set content bottom margin because of the uncovering footer
488     */
489    function mkdfSetContentBottomMargin(){
490        var uncoverFooter = $('.mkdf-footer-uncover');
491
492        if(uncoverFooter.length){
493            $('.mkdf-content').css('margin-bottom', $('.mkdf-footer-inner').height());
494        }
495    }
496
497	/*
498	** Initiate Smooth Scroll
499	*/
500	function mkdfSmoothScroll(){
501
502		if(mkdf.body.hasClass('mkdf-smooth-scroll')){
503
504			var scrollTime = 0.4;			//Scroll time
505			var scrollDistance = 300;		//Distance. Use smaller value for shorter scroll and greater value for longer scroll
506
507			var mobile_ie = -1 !== navigator.userAgent.indexOf("IEMobile");
508
509			var smoothScrollListener = function(event){
510				event.preventDefault();
511
512				var delta = event.wheelDelta / 120 || -event.detail / 3;
513				var scrollTop = mkdf.window.scrollTop();
514				var finalScroll = scrollTop - parseInt(delta * scrollDistance);
515
516				TweenLite.to(mkdf.window, scrollTime, {
517					scrollTo: {
518						y: finalScroll, autoKill: !0
519					},
520					ease: Power1.easeOut,
521					autoKill: !0,
522					overwrite: 5
523				});
524			};
525
526			if (!$('html').hasClass('touch') && !mobile_ie) {
527				if (window.addEventListener) {
528					window.addEventListener('wheel', smoothScrollListener, {passive: false});
529				}
530			}
531		}
532	}
533
534    function mkdfDisableScroll() {
535
536        if (window.addEventListener) {
537	        window.addEventListener('wheel', mkdfWheel, {passive: false});
538        }
539        //window.onmousewheel = document.onmousewheel = mkdfWheel;
540        document.onkeydown = mkdfKeydown;
541
542        if(mkdf.body.hasClass('mkdf-smooth-scroll')){
543            window.removeEventListener('wheel', smoothScrollListener, {passive: false});
544            //window.removeEventListener('DOMMouseScroll', smoothScrollListener, false);
545        }
546    }
547
548    function mkdfEnableScroll() {
549        if (window.removeEventListener) {
550            window.removeEventListener('wheel', mkdfWheel, {passive: false});
551        }
552        window.onmousewheel = document.onmousewheel = document.onkeydown = null;
553
554        if(mkdf.body.hasClass('mkdf-smooth-scroll')){
555            window.addEventListener('wheel', smoothScrollListener, {passive: false});
556            //window.addEventListener('DOMMouseScroll', smoothScrollListener, false);
557        }
558    }
559
560    function mkdfWheel(e) {
561        mkdfPreventDefaultValue(e);
562    }
563
564    function mkdfKeydown(e) {
565        var keys = [37, 38, 39, 40];
566
567        for (var i = keys.length; i--;) {
568            if (e.keyCode === keys[i]) {
569                mkdfPreventDefaultValue(e);
570                return;
571            }
572        }
573    }
574
575    function mkdfPreventDefaultValue(e) {
576        e = e || window.event;
577        if (e.preventDefault) {
578            e.preventDefault();
579        }
580        e.returnValue = false;
581    }
582
583    function mkdfInitSelfHostedVideoPlayer() {
584
585        var players = $('.mkdf-self-hosted-video');
586            players.mediaelementplayer({
587                audioWidth: '100%'
588            });
589    }
590
591	function mkdfSelfHostedVideoSize(){
592
593		$('.mkdf-self-hosted-video-holder .mkdf-video-wrap').each(function(){
594			var thisVideo = $(this);
595
596			var videoWidth = thisVideo.closest('.mkdf-self-hosted-video-holder').outerWidth();
597			var videoHeight = videoWidth / mkdf.videoRatio;
598
599			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
600				thisVideo.parent().width(videoWidth);
601				thisVideo.parent().height(videoHeight);
602			}
603
604			thisVideo.width(videoWidth);
605			thisVideo.height(videoHeight);
606
607			thisVideo.find('video, .mejs-overlay, .mejs-poster').width(videoWidth);
608			thisVideo.find('video, .mejs-overlay, .mejs-poster').height(videoHeight);
609		});
610	}
611
612    function mkdfToTopButton(a) {
613        
614        var b = $("#mkdf-back-to-top");
615        b.removeClass('off on');
616        if (a === 'on') { b.addClass('on'); } else { b.addClass('off'); }
617    }
618
619    function mkdfBackButtonShowHide(){
620        mkdf.window.scroll(function () {
621            var b = $(this).scrollTop();
622            var c = $(this).height();
623            var d;
624            if (b > 0) { d = b + c / 2; } else { d = 1; }
625            if (d < 1e3) { mkdfToTopButton('off'); } else { mkdfToTopButton('on'); }
626        });
627    }
628
629    function mkdfInitBackToTop(){
630        var backToTopButton = $('#mkdf-back-to-top');
631        backToTopButton.on('click',function(e){
632            e.preventDefault();
633            mkdf.html.animate({scrollTop: 0}, mkdf.window.scrollTop()/3, 'linear');
634        });
635    }
636
637})(jQuery);
638
639
640
641(function($) {
642    "use strict";
643
644    var header = {};
645    mkdf.modules.header = header;
646
647    header.isStickyVisible = false;
648    header.stickyAppearAmount = 0;
649    header.behaviour;
650    header.mkdfSideArea = mkdfSideArea;
651    header.mkdfInitMobileNavigation = mkdfInitMobileNavigation;
652    header.mkdfMobileHeaderBehavior = mkdfMobileHeaderBehavior;
653    header.mkdfSetDropDownMenuPosition = mkdfSetDropDownMenuPosition;
654    header.mkdfDropDownMenu = mkdfDropDownMenu;
655    header.mkdfSearch = mkdfSearch;
656
657    $(document).ready(function() {
658        mkdfHeaderBehaviour();
659        mkdfSideArea();
660        mkdfSideAreaScroll();
661        mkdfInitMobileNavigation();
662        mkdfMobileHeaderBehavior();
663        mkdfSetDropDownMenuPosition();
664        mkdfSearch();
665        mkdfVerticalMenu().init();
666    });
667
668    $(window).on('load', function() {
669        mkdfSetDropDownMenuPosition();
670        mkdfDropDownMenu();
671    });
672
673    $(window).resize(function() {
674        mkdfDropDownMenu();
675    });
676
677    /*
678     **	Show/Hide sticky header on window scroll
679     */
680    function mkdfHeaderBehaviour() {
681
682        var header = $('.mkdf-page-header');
683        var stickyHeader = $('.mkdf-sticky-header');
684        var fixedHeaderWrapper = $('.mkdf-fixed-wrapper');
685
686        var headerMenuAreaOffset = $('.mkdf-page-header').find('.mkdf-fixed-wrapper').length ? $('.mkdf-page-header').find('.mkdf-fixed-wrapper').offset().top : null;
687
688        var stickyAppearAmount;
689
690
691        switch(true) {
692            // sticky header that will be shown when user scrolls up
693            case mkdf.body.hasClass('mkdf-sticky-header-on-scroll-up'):
694                mkdf.modules.header.behaviour = 'mkdf-sticky-header-on-scroll-up';
695                var docYScroll1 = $(document).scrollTop();
696                stickyAppearAmount = mkdfGlobalVars.vars.mkdfTopBarHeight + mkdfGlobalVars.vars.mkdfLogoAreaHeight + mkdfGlobalVars.vars.mkdfMenuAreaHeight + mkdfGlobalVars.vars.mkdfStickyHeaderHeight;
697
698                var headerAppear = function(){
699                    var docYScroll2 = $(document).scrollTop();
700
701                    if((docYScroll2 > docYScroll1 && docYScroll2 > stickyAppearAmount) || (docYScroll2 < stickyAppearAmount)) {
702                        mkdf.modules.header.isStickyVisible= false;
703                        stickyHeader.removeClass('header-appear').find('.mkdf-main-menu .second').removeClass('mkdf-drop-down-start');
704                    }else {
705                        mkdf.modules.header.isStickyVisible = true;
706                        stickyHeader.addClass('header-appear');
707                    }
708
709                    docYScroll1 = $(document).scrollTop();
710                };
711                headerAppear();
712
713                $(window).scroll(function() {
714                    headerAppear();
715                });
716
717                break;
718
719            // sticky header that will be shown when user scrolls both up and down
720            case mkdf.body.hasClass('mkdf-sticky-header-on-scroll-down-up'):
721                mkdf.modules.header.behaviour = 'mkdf-sticky-header-on-scroll-down-up';
722                stickyAppearAmount = mkdfPerPageVars.vars.mkdfStickyScrollAmount !== 0 ? mkdfPerPageVars.vars.mkdfStickyScrollAmount : mkdfGlobalVars.vars.mkdfTopBarHeight + mkdfGlobalVars.vars.mkdfLogoAreaHeight + mkdfGlobalVars.vars.mkdfMenuAreaHeight;
723                mkdf.modules.header.stickyAppearAmount = stickyAppearAmount; //used in anchor logic
724                
725                var headerAppear = function(){
726                    if(mkdf.scroll < stickyAppearAmount) {
727                        mkdf.modules.header.isStickyVisible = false;
728                        stickyHeader.removeClass('header-appear').find('.mkdf-main-menu .second').removeClass('mkdf-drop-down-start');
729                    }else{
730                        mkdf.modules.header.isStickyVisible = true;
731                        stickyHeader.addClass('header-appear');
732                    }
733                };
734
735                headerAppear();
736
737                $(window).scroll(function() {
738                    headerAppear();
739                });
740
741                break;
742
743            // on scroll down, part of header will be sticky
744            case mkdf.body.hasClass('mkdf-fixed-on-scroll'):
745                mkdf.modules.header.behaviour = 'mkdf-fixed-on-scroll';
746                var headerFixed = function(){
747                    if(mkdf.scroll < headerMenuAreaOffset){
748                        fixedHeaderWrapper.removeClass('fixed');
749                        header.css('margin-bottom',0);}
750                    else{
751                        fixedHeaderWrapper.addClass('fixed');
752                        header.css('margin-bottom',fixedHeaderWrapper.height());
753                    }
754                };
755
756                headerFixed();
757
758                $(window).scroll(function() {
759                    headerFixed();
760                });
761
762                break;
763        }
764    }
765
766    /**
767     * Show/hide side area
768     */
769    function mkdfSideArea() {
770
771        var wrapper = $('.mkdf-wrapper'),
772            sideMenu = $('.mkdf-side-menu'),
773            sideMenuButtonOpen = $('a.mkdf-side-menu-button-opener'),
774            cssClass,
775        //Flags
776            slideFromRight = false,
777            slideWithContent = false,
778            slideUncovered = false;
779
780        if (mkdf.body.hasClass('mkdf-side-menu-slide-from-right')) {
781
782            cssClass = 'mkdf-right-side-menu-opened';
783            wrapper.prepend('<div class="mkdf-cover"/>');
784            slideFromRight = true;
785
786        } else if (mkdf.body.hasClass('mkdf-side-menu-slide-with-content')) {
787
788            cssClass = 'mkdf-side-menu-open';
789            slideWithContent = true;
790
791        }
791 else if (mkdf.body.hasClass('mkdf-side-area-uncovered-from-content')) {
792
793            cssClass = 'mkdf-right-side-menu-opened';
794            slideUncovered = true;
795
796        }
797
798        $('a.mkdf-side-menu-button-opener, a.mkdf-close-side-menu').on('click', function(e) {
799            e.preventDefault();
800
801            if(!sideMenuButtonOpen.hasClass('opened')) {
802
803                sideMenuButtonOpen.addClass('opened');
804                mkdf.body.addClass(cssClass);
805
806                if (slideFromRight) {
807                    $('.mkdf-wrapper .mkdf-cover').on('click',function() {
808                        mkdf.body.removeClass('mkdf-right-side-menu-opened');
809                        sideMenuButtonOpen.removeClass('opened');
810                    });
811                }
812
813                if (slideUncovered) {
814                    sideMenu.css({
815                        'visibility' : 'visible'
816                    });
817                }
818
819                var currentScroll = $(window).scrollTop();
820                $(window).scroll(function() {
821                    if(Math.abs(mkdf.scroll - currentScroll) > 400){
822                        mkdf.body.removeClass(cssClass);
823                        sideMenuButtonOpen.removeClass('opened');
824                        if (slideUncovered) {
825                            var hideSideMenu = setTimeout(function(){
826                                sideMenu.css({'visibility':'hidden'});
827                                clearTimeout(hideSideMenu);
828                            },400);
829                        }
830                    }
831                });
832
833            } else {
834
835                sideMenuButtonOpen.removeClass('opened');
836                mkdf.body.removeClass(cssClass);
837                if (slideUncovered) {
838                    var hideSideMenu = setTimeout(function(){
839                        sideMenu.css({'visibility':'hidden'});
840                        clearTimeout(hideSideMenu);
841                    },400);
842                }
843
844            }
845
846            if (slideWithContent) {
847
848                e.stopPropagation();
849                wrapper.on('click',function() {
850                    e.preventDefault();
851                    sideMenuButtonOpen.removeClass('opened');
852                    mkdf.body.removeClass('mkdf-side-menu-open');
853                });
854
855            }
856
857        });
858
859    }
860
861    function mkdfSideAreaScroll(){
862
863        var sideMenu = $('.mkdf-side-menu');
864
865        if(sideMenu.length){
866            sideMenu.niceScroll({
867                scrollspeed: 60,
868                mousescrollstep: 40,
869                cursorwidth: 0,
870                cursorborder: 0,
871                cursorborderradius: 0,
872                cursorcolor: 'transparent',
873                autohidemode: false,
874                horizrailenabled: false
875            });
876        }
877    }
878
879    function mkdfInitMobileNavigation() {
880        var navigationOpener = $('.mkdf-mobile-header .mkdf-mobile-menu-opener');
881        var navigationHolder = $('.mkdf-mobile-header .mkdf-mobile-nav');
882        var dropdownOpener = $('.mkdf-mobile-nav .mobile_arrow, .mkdf-mobile-nav h4, .mkdf-mobile-nav a[href*="#"]');
883        var animationSpeed = 200;
884
885        //whole mobile menu opening / closing
886        if(navigationOpener.length && navigationHolder.length) {
887            navigationOpener.on('tap click', function(e) {
888                e.stopPropagation();
889                e.preventDefault();
890
891                if(navigationHolder.is(':visible')) {
892                    navigationHolder.slideUp(animationSpeed);
893                } else {
894                    navigationHolder.slideDown(animationSpeed);
895                }
896            });
897        }
898
899        //dropdown opening / closing
900        if(dropdownOpener.length) {
901            dropdownOpener.each(function() {
902                $(this).on('tap click', function(e) {
903                    var dropdownToOpen = $(this).nextAll('ul').first();
904
905					if(dropdownToOpen.length) {
906						e.preventDefault();
907						e.stopPropagation();
908
909						var openerParent = $(this).parent('li');
910						if(dropdownToOpen.is(':visible')) {
911							dropdownToOpen.slideUp(animationSpeed);
912							openerParent.removeClass('mkdf-opened');
913						} else {
914							dropdownToOpen.slideDown(animationSpeed);
915							openerParent.addClass('mkdf-opened');
916						}
917					}
918                });
919            });
920        }
921
922        $('.mkdf-mobile-nav a, .mkdf-mobile-logo-wrapper a').on('click tap', function(e) {
923            if($(this).attr('href') !== 'http://#' && $(this).attr('href') !== '#') {
924                navigationHolder.slideUp(animationSpeed);
925            }
926        });
927    }
928
929    function mkdfMobileHeaderBehavior() {
930        if(mkdf.body.hasClass('mkdf-sticky-up-mobile-header')) {
931            var stickyAppearAmount;
932            var mobileHeader = $('.mkdf-mobile-header');
933            var adminBar     = $('#wpadminbar');
934            var mobileHeaderHeight = mobileHeader.length ? mobileHeader.height() : 0;
935            var adminBarHeight = adminBar.length ? adminBar.height() : 0;
936
937            var docYScroll1 = $(document).scrollTop();
938            stickyAppearAmount = mobileHeaderHeight + adminBarHeight;
939
940            $(window).scroll(function() {
941                var docYScroll2 = $(document).scrollTop();
942
943                if(docYScroll2 > stickyAppearAmount) {
944                    mobileHeader.addClass('mkdf-animate-mobile-header');
945                } else {
946                    mobileHeader.removeClass('mkdf-animate-mobile-header');
947                }
948
949                if((docYScroll2 > docYScroll1 && docYScroll2 > stickyAppearAmount) || (docYScroll2 < stickyAppearAmount)) {
950                    mobileHeader.removeClass('mobile-header-appear');
951                    mobileHeader.css('margin-bottom', 0);
952
953                    if(adminBar.length) {
954                        mobileHeader.find('.mkdf-mobile-header-inner').css('top', 0);
955                    }
956                } else {
957                    mobileHeader.addClass('mobile-header-appear');
958                    mobileHeader.css('margin-bottom', stickyAppearAmount);
959
960                    //if(adminBar.length) {
961                    //    mobileHeader.find('.mkdf-mobile-header-inner').css('top', adminBarHeight);
962                    //}
963                }
964
965                docYScroll1 = $(document).scrollTop();
966            });
967        }
968
969    }
970
971
972    /**
973     * Set dropdown position
974     */
975    function mkdfSetDropDownMenuPosition(){
976
977        var menuItems = $(".mkdf-drop-down > ul > li.narrow");
978        menuItems.each( function() {
979
980            var browserWidth = mkdf.windowWidth-16; // 16 is width of scroll bar
981            var menuItemPosition = $(this).offset().left;
982            var dropdownMenuWidth = $(this).find('.second .inner ul').width();
983
984            var menuItemFromLeft = 0;
985            if(mkdf.body.hasClass('boxed')){
986                menuItemFromLeft = mkdf.boxedLayoutWidth  - (menuItemPosition - (browserWidth - mkdf.boxedLayoutWidth )/2);
987            } else {
988                menuItemFromLeft = browserWidth - menuItemPosition;
989            }
990
991            var dropDownMenuFromLeft; //has to stay undefined beacuse 'dropDownMenuFromLeft < dropdownMenuWidth' condition will be true
992
993            if($(this).find('li.sub').length > 0){
994                dropDownMenuFromLeft = menuItemFromLeft - dropdownMenuWidth;
995            }
996
997            if(menuItemFromLeft < dropdownMenuWidth || dropDownMenuFromLeft < dropdownMenuWidth){
998                $(this).find('.second').addClass('right');
999                $(this).find('.second .inner ul').addClass('right');
1000            }
1001        });
1002
1003    }
1004
1005
1006    function mkdfDropDownMenu() {
1007
1008        var menu_items = $('.mkdf-drop-down > ul > li');
1009
1010        menu_items.each(function(i) {
1011            if($(menu_items[i]).find('.second').length > 0) {
1012
1013                var dropDownSecondDiv = $(menu_items[i]).find('.second');
1014
1015                if($(menu_items[i]).hasClass('wide')) {
1016
1017                    var dropdown = $(this).find('.inner > ul');
1018                    var dropdownPadding = parseInt(dropdown.css('padding-left').slice(0, -2)) + parseInt(dropdown.css('padding-right').slice(0, -2));
1019                    var dropdownWidth = dropdown.outerWidth();
1020
1021                    if(!$(this).hasClass('left_position') && !$(this).hasClass('right_position')) {
1022                        dropDownSecondDiv.css('left', 0);
1023                    }
1024
1025                    //set columns to be same height - start
1026                    var tallest = 0;
1027                    $(this).find('.second > .inner > ul > li').each(function() {
1028                        var thisHeight = $(this).height();
1029                        if(thisHeight > tallest) {
1030                            tallest = thisHeight;
1031                        }
1032                    });
1033                    $(this).find('.second > .inner > ul > li').css("height", ""); // delete old inline css - via resize
1034                    $(this).find('.second > .inner > ul > li').height(tallest);
1035                    //set columns to be same height - end
1036
1037                    if(!$(this).hasClass('wide_background')) {
1038                        if(!$(this).hasClass('left_position') && !$(this).hasClass('right_position')) {
1039                            var left_position = (mkdf.windowWidth - 2 * (mkdf.windowWidth - dropdown.offset().left)) / 2 + (dropdownWidth + dropdownPadding) / 2;
1040                            dropDownSecondDiv.css('left', -left_position);
1041                        }
1042                    } else {
1043                        if(!$(this).hasClass('left_position') && !$(this).hasClass('right_position')) {
1044                            var left_position = dropdown.offset().left;
1045                            dropDownSecondDiv.css('left', -left_position);
1046                            dropDownSecondDiv.css('width', mkdf.windowWidth);
1047
1048                        }
1049                    }
1050                }
1051
1052                if(!mkdf.menuDropdownHeightSet) {
1053                    $(menu_items[i]).data('original_height', dropDownSecondDiv.height() + 'px');
1054                    dropDownSecondDiv.height(0);
1055                }
1056
1057                if(navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
1058                    $(menu_items[i]).on("touchstart mouseenter", function() {
1059                        dropDownSecondDiv.css({
1060                            'height': $(menu_items[i]).data('original_height'),
1061                            'overflow': 'visible',
1062                            'visibility': 'visible',
1063                            'opacity': '1'
1064                        });
1065                    }).on("mouseleave", function() {
1066                        dropDownSecondDiv.css({
1067                            'height': '0px',
1068                            'overflow': 'hidden',
1069                            'visibility': 'hidden',
1070                            'opacity': '0'
1071                        });
1072                    });
1073
1074                } else {
1075                    if(mkdf.body.hasClass('mkdf-dropdown-animate-height')) {
1076                        $(menu_items[i]).mouseenter(function() {
1077                            dropDownSecondDiv.css({
1078                                'visibility': 'visible',
1079                                'height': '0px',
1080                                'opacity': '0'
1081                            });
1082                            dropDownSecondDiv.stop().animate({
1083                                'height': $(menu_items[i]).data('original_height'),
1084                                opacity: 1
1085                            }, 200, function() {
1086                                dropDownSecondDiv.css('overflow', 'visible');
1087                            });
1088                        }).mouseleave(function() {
1089                            dropDownSecondDiv.stop().animate({
1090                                'height': '0px'
1091                            }, 0, function() {
1092                                dropDownSecondDiv.css({
1093                                    'overflow': 'hidden',
1094                                    'visibility': 'hidden'
1095                                });
1096                            });
1097                        });
1098                    } else {
1099                        var config = {
1100                            interval: 0,
1101                            over: function() {
1102                                setTimeout(function() {
1103                                    dropDownSecondDiv.addClass('mkdf-drop-down-start');
1104                                    dropDownSecondDiv.stop().css({'height': $(menu_items[i]).data('original_height')});
1105                                }, 150);
1106                            },
1107                            timeout: 150,
1108                            out: function() {
1109                                dropDownSecondDiv.stop().css({'height': '0px'});
1110                                dropDownSecondDiv.removeClass('mkdf-drop-down-start');
1111                            }
1112                        };
1113                        $(menu_items[i]).hoverIntent(config);
1114                    }
1115                }
1116            }
1117        });
1118        $('.mkdf-drop-down ul li.wide ul li a').on('click', function() {
1119            var $this = $(this);
1120            setTimeout(function() {
1121                $this.mouseleave();
1122            }, 500);
1123
1124        });
1125
1126        mkdf.menuDropdownHeightSet = true;
1127    }
1128
1129    /**
1130     * Init Search Types
1131     */
1132    function mkdfSearch() {
1133
1134        var searchOpener = $('a.mkdf-search-opener'),
1135            searchClose,
1136            searchForm,
1137            touch = false;
1138
1139        if ( $('html').hasClass( 'touch' ) ) {
1140            touch = true;
1141        }
1142
1143        if ( searchOpener.length > 0 ) {
1144            //Check for type of search
1145            if ( mkdf.body.hasClass( 'mkdf-fullscreen-search' ) ) {
1146
1147                var fullscreenSearchFade = false,
1148                    fullscreenSearchFromCircle = false;
1149
1150                searchClose = $( '.mkdf-fullscreen-search-close' );
1151
1152                if (mkdf.body.hasClass('mkdf-search-fade')) {
1153                    fullscreenSearchFade = true;
1154                } else if (mkdf.body.hasClass('mkdf-search-from-circle')) {
1155                    fullscreenSearchFromCircle = true;
1156                }
1157                mkdfFullscreenSearch( fullscreenSearchFade, fullscreenSearchFromCircle );
1158
1159            } else if ( mkdf.body.hasClass( 'mkdf-search-slides-from-window-top' ) ) {
1160
1161                searchForm = $('.mkdf-search-slide-window-top');
1162                searchClose = $('.mkdf-search-close');
1163                mkdfSearchWindowTop();
1164
1165            }
1166
1167        }
1168
1169        /**
1170         * Search slides from window top type of search
1171         */
1172        function mkdfSearchWindowTop() {
1173
1174            searchOpener.on('click', function(e) {
1175                e.preventDefault();
1176
1177                if($('.title').hasClass('has_parallax_background')){
1178                    var yPos = parseInt($('.title.has_parallax_background').css('backgroundPosition').split(" ")[1]);
1179                }else {
1180                    var yPos = 0;
1181                }
1182                if ( searchForm.height() == "0") {
1183                    $('.mkdf-search-slide-window-top input[type="text"]').focus();
1184                    //Push header bottom
1185                    mkdf.body.addClass('mkdf-search-open');
1186                    $('.title.has_parallax_background').animate({
1187                        'background-position-y': (yPos + 50)+'px'
1188                    }, 150);
1189                } else {
1190                    mkdf.body.removeClass('mkdf-search-open');
1191                    $('.title.has_parallax_background').animate({
1192                        'background-position-y': (yPos - 50)+'px'
1193                    }, 150);
1194                }
1195
1196                $(window).scroll(function() {
1197                    if ( searchForm.height() != '0' && mkdf.scroll > 50 ) {
1198                        mkdf.body.removeClass('mkdf-search-open');
1199                        $('.title.has_parallax_background').css('backgroundPosition', 'center '+(yPos)+'px');
1200                    }
1201                });
1202
1203                searchClose.on('click',function(e){
1204                    e.preventDefault();
1205                    mkdf.body.removeClass('mkdf-search-open');
1206                    $('.title.has_parallax_background').animate({
1207                        'background-position-y': (yPos)+'px'
1208                    }, 150);
1209                });
1210
1211            });
1212        }
1213
1214        /**
1215         * Fullscreen search (two types: fade and from circle)
1216         */
1217        function mkdfFullscreenSearch( fade, fromCircle ) {
1218
1219            var searchHolder = $( '.mkdf-fullscreen-search-holder'),
1220                searchOverlay = $( '.mkdf-fullscreen-search-overlay' );
1221
1222            searchOpener.on('click', function(e) {
1223                e.preventDefault();
1224                var samePosition = false;
1225                if ( $(this).data('icon-close-same-position') === 'yes' ) {
1226                    var closeTop = $(this).offset().top;
1227                    var closeLeft = $(this).offset().left;
1228                    samePosition = true;
1229                }
1230                //Fullscreen search fade
1231                if ( fade ) {
1232                    if ( searchHolder.hasClass( 'mkdf-animate' ) ) {
1233                        mkdf.body.removeClass('mkdf-fullscreen-search-opened');
1234                        mkdf.body.addClass( 'mkdf-search-fade-out' );
1235                        mkdf.body.removeClass( 'mkdf-search-fade-in' );
1236                        searchHolder.removeClass( 'mkdf-animate' );
1237                        if(!mkdf.body.hasClass('page-template-full_screen-php')){
1238                            mkdf.modules.common.mkdfEnableScroll();
1239                        }
1240                    } else {
1241                        mkdf.body.addClass('mkdf-fullscreen-search-opened');
1242                        mkdf.body.removeClass('mkdf-search-fade-out');
1243                        mkdf.body.addClass('mkdf-search-fade-in');
1244                        searchHolder.addClass('mkdf-animate');
1245                        if (samePosition) {
1246                            searchClose.css({
1247                                'top' : closeTop - mkdf.scroll, // Distance from top of viewport ( distance from top of window - scroll distance )
1248                                'left' : closeLeft
1249                            });
1250                        }
1251                        if(!mkdf.body.hasClass('page-template-full_screen-php')){
1252                            mkdf.modules.common.mkdfDisableScroll();
1253                        }
1254                    }
1255                    searchClose.on('click', function(e) {
1256                        e.preventDefault();
1257                        mkdf.body.removeClass('mkdf-fullscreen-search-opened');
1258                        searchHolder.removeClass('mkdf-animate');
1259                        mkdf.body.removeClass('mkdf-search-fade-in');
1260                        mkdf.body.addClass('mkdf-search-fade-out');
1261                        if(!mkdf.body.hasClass('page-template-full_screen-php')){
1262                            mkdf.modules.common.mkdfEnableScroll();
1263                        }
1264                    });
1265                    //Close on escape
1266                    $(document).keyup(function(e){
1267                        if (e.keyCode == 27 ) { //KeyCode for ESC button is 27
1268                            mkdf.body.removeClass('mkdf-fullscreen-search-opened');
1269                            searchHolder.removeClass('mkdf-animate');
1270                            mkdf.body.removeClass('mkdf-search-fade-in');
1271                            mkdf.body.addClass('mkdf-search-fade-out');
1272                            if(!mkdf.body.hasClass('page-template-full_screen-php')){
1273                                mkdf.modules.common.mkdfEnableScroll();
1274                            }
1275                        }
1276                    });
1277                }
1278                //Fullscreen search from circle
1279                if ( fromCircle ) {
1280                    if( searchOverlay.hasClass('mkdf-animate') ) {
1281                        searchOverlay.removeClass('mkdf-animate');
1282                        searchHolder.css({
1283                            'opacity': 0,
1284                            'display':'none'
1285                        });
1286                        searchClose.css({
1287                            'opacity' : 0,
1288                            'visibility' : 'hidden'
1289                        });
1290                        searchOpener.css({
1291                            'opacity': 1
1292                        });
1293                    } else {
1294                        searchOverlay.addClass('mkdf-animate');
1295                        searchHolder.css({
1296                            'display':'block'
1297                        });
1298                        setTimeout(function(){
1299                            searchHolder.css('opacity','1');
1300                            searchClose.css({
1301                                'opacity' : 1,
1302                                'visibility' : 'visible',
1303                                'top' : closeTop - mkdf.scroll, // Distance from top of viewport ( distance from top of window - scroll distance )
1304                                'left' : closeLeft
1305                            });
1306                            if (samePosition) {
1307                                searchClose.css({
1308                                    'top' : closeTop - mkdf.scroll, // Distance from top of viewport ( distance from top of window - scroll distance )
1309                                    'left' : closeLeft
1310                                });
1311                            }
1312                            searchOpener.css({
1313                                'opacity' : 0
1314                            });
1315                        },200);
1316                        if(!mkdf.body.hasClass('page-template-full_screen-php')){
1317                            mkdf.modules.common.mkdfDisableScroll();
1318                        }
1319                    }
1320                    searchClose.on('click',function(e) {
1321                        e.preventDefault();
1322                        searchOverlay.removeClass('mkdf-animate');
1323                        searchHolder.css({
1324                            'opacity' : 0,
1325                            'display' : 'none'
1326                        });
1327                        searchClose.css({
1328                            'opacity':0,
1329                            'visibility' : 'hidden'
1330                        });
1331                        searchOpener.css({
1332                            'opacity' : 1
1333                        });
1334                        if(!mkdf.body.hasClass('page-template-full_screen-php')){
1335                            mkdf.modules.common.mkdfEnableScroll();
1336                        }
1337                    });
1338                    //Close on escape
1339                    $(document).keyup(function(e){
1340                        if (e.keyCode == 27 ) { //KeyCode for ESC button is 27
1341                            searchOverlay.removeClass('mkdf-animate');
1342                            searchHolder.css({
1343                                'opacity' : 0,
1344                                'display' : 'none'
1345                            });
1346                            searchClose.css({
1347                                'opacity':0,
1348                                'visibility' : 'hidden'
1349                            });
1350                            searchOpener.css({
1351                                'opacity' : 1
1352                            });
1353                            if(!mkdf.body.hasClass('page-template-full_screen-php')){
1354                                mkdf.modules.common.mkdfEnableScroll();
1355                            }
1356                        }
1357                    });
1358                }
1359            });
1360
1361            //Text input focus change
1362            $('.mkdf-fullscreen-search-holder .mkdf-search-field').focus(function(){
1363                $('.mkdf-fullscreen-search-holder .mkdf-field-holder .mkdf-line').css("width","100%");
1364            });
1365
1366            $('.mkdf-fullscreen-search-holder .mkdf-search-field').blur(function(){
1367                $('.mkdf-fullscreen-search-holder .mkdf-field-holder .mkdf-line').css("width","0");
1368            });
1369
1370        }
1371
1372    }
1373
1374    /**
1375     * Function object that represents vertical menu area.
1376     * @returns {{init: Function}}
1377     */
1378    var mkdfVerticalMenu = function() {
1379        /**
1380         * Main vertical area object that used through out function
1381         * @type {jQuery object}
1382         */
1383        var verticalMenuObject = $('.mkdf-vertical-menu-area');
1384
1385        /**
1386         * Resizes vertical area. Called whenever height of navigation area changes
1387         * It first check if vertical area is scrollable, and if it is resizes scrollable area
1388         */
1389        //var resizeVerticalArea = function() {
1390        //    if(verticalAreaScrollable()) {
1391        //        verticalMenuObject.getNiceScroll().resize();
1392        //    }
1393        //};
1394
1395        /**
1396         * Checks if vertical area is scrollable (if it has mkdf-with-scroll class)
1397         *
1398         * @returns {bool}
1399         */
1400        //var verticalAreaScrollable = function() {
1401        //    return verticalMenuObject.hasClass('.mkdf-with-scroll');
1402        //};
1403
1404        /**
1405         * Initialzes navigation functionality. It checks navigation type data attribute and calls proper functions
1406         */
1407        var initNavigation = function() {
1408            var verticalNavObject = verticalMenuObject.find('.mkdf-vertical-menu');
1409            var navigationType = typeof verticalNavObject.data('navigation-type') !== 'undefined' ? verticalNavObject.data('navigation-type') : '';
1410
1411            switch(navigationType) {
1412                //case 'dropdown-toggle':
1413                //    dropdownHoverToggle();
1414                //    break;
1415                //case 'dropdown-toggle-click':
1416                //    dropdownClickToggle();
1417                //    break;
1418                //case 'float':
1419                //    dropdownFloat();
1420                //    break;
1421                //case 'slide-in':
1422                //    dropdownSlideIn();
1423                //    break;
1424                default:
1425                    dropdownFloat();
1426                    break;
1427            }
1428
1429            /**
1430             * Initializes click toggle navigation type. Works the same for touch and no-touch devices
1431             */
1432            //function dropdownClickToggle() {
1433            //    var menuItems = verticalNavObject.find('ul li.menu-item-has-children');
1434            //
1435            //    menuItems.each(function() {
1436            //        var elementToExpand = $(this).find(' > .second, > ul');
1437            //        var menuItem = this;
1438            //        var dropdownOpener = $(this).find('> a');
1439            //        var slideUpSpeed = 'fast';
1440            //        var slideDownSpeed = 'slow';
1441            //
1442            //        dropdownOpener.on('click tap', function(e) {
1443            //            e.preventDefault();
1444            //            e.stopPropagation();
1445            //
1446            //            if(elementToExpand.is(':visible')) {
1447            //                $(menuItem).removeClass('open');
1448            //                elementToExpand.slideUp(slideUpSpeed, function() {
1449            //                    resizeVerticalArea();
1450            //                });
1451            //            } else {
1452            //                if(!$(this).parents('li').hasClass('open')) {
1453            //                    menuItems.removeClass('open');
1454            //                    menuItems.find(' > .second, > ul').slideUp(slideUpSpeed);
1455            //                }
1456            //
1457            //                $(menuItem).addClass('open');
1458            //                elementToExpand.slideDown(slideDownSpeed, function() {
1459            //                    resizeVerticalArea();
1460            //                });
1461            //            }
1462            //        });
1463            //    });
1464            //}
1465
1466            /**
1467             * Initializes floating navigation type (it comes from the side as a dropdown)
1468             */
1469            function dropdownFloat() {
1470                var menuItems = verticalNavObject.find('ul li.menu-item-has-children');
1471                var allDropdowns = menuItems.find(' > .second, > ul');
1472
1473                menuItems.each(function() {
1474                    var elementToExpand = $(this).find(' > .second, > ul');
1475                    var menuItem = this;
1476
1477                    if(Modernizr.touch) {
1478                        var dropdownOpener = $(this).find('> a');
1479
1480                        dropdownOpener.on('click tap', function(e) {
1481                            e.preventDefault();
1482                            e.stopPropagation();
1483
1484                            if(elementToExpand.hasClass('mkdf-float-open')) {
1485                                elementToExpand.removeClass('mkdf-float-open');
1486                                $(menuItem).removeClass('open');
1487                            } else {
1488                                if(!$(this).parents('li').hasClass('open')) {
1489                                    menuItems.removeClass('open');
1490                                    allDropdowns.removeClass('mkdf-float-open');
1491                                }
1492
1493                                elementToExpand.addClass('mkdf-float-open');
1494                                $(menuItem).addClass('open');
1495                            }
1496                        });
1497                    } else {
1498                        //must use hoverIntent because basic hover effect doesn't catch dropdown
1499                        //it doesn't start from menu item's edge
1500                        $(this).hoverIntent({
1501                            over: function() {
1502                                elementToExpand.addClass('mkdf-float-open');
1503                                $(menuItem).addClass('open');
1504                            },
1505                            out: function() {
1506                                elementToExpand.removeClass('mkdf-float-open');
1507                                $(menuItem).removeClass('open');
1508                            },
1509                            timeout: 300
1510                        });
1511                    }
1512                });
1513            }
1514
1515            /**
1516             * Initializes slide in navigation type (dropdowns are coming on top of parent element and cover whole navigation area)
1517             */
1518            //function dropdownSlideIn() {
1519            //    var menuItems = verticalNavObject.find('ul li.menu-item-has-children');
1520            //    var menuItemsLinks = menuItems.find('> a');
1521            //
1522            //    menuItemsLinks.each(function() {
1523            //        var elementToExpand = $(this).next('.second, ul');
1524            //        appendToExpandableElement(elementToExpand, this);
1525            //
1526            //        if($(this).parent('li').is('.current-menu-ancestor', '.current_page_parent', '.current-menu-parent ')) {
1527            //            elementToExpand.addClass('mkdf-vertical-slide-open');
1528            //        }
1529            //
1530            //        $(this).on('click tap', function(e) {
1531            //            e.preventDefault();
1532            //            e.stopPropagation();
1533            //
1534            //            menuItems.removeClass('open');
1535            //
1536            //            $(this).parent('li').addClass('open');
1537            //            elementToExpand.addClass('mkdf-vertical-slide-open');
1538            //        });
1539            //    });
1540            //
1541            //    var previousLevelItems = menuItems.find('li.mkdf-previous-level > a');
1542            //
1543            //    previousLevelItems.on('click tap', function(e) {
1544            //        e.preventDefault();
1545            //        e.stopPropagation();
1546            //
1547            //        menuItems.removeClass('open');
1548            //        $(this).parents('.mkdf-vertical-slide-open').first().removeClass('mkdf-vertical-slide-open');
1549            //    });
1550            //
1551            //    /**
1552            //     * Appends 'li' element as first element in dropdown, which will close current dropdown when clicked
1553            //     * @param {jQuery object} elementToExpand current dropdown to append element to
1554            //     * @param currentMenuItem
1555            //     */
1556            //    function appendToExpandableElement(elementToExpand, currentMenuItem) {
1557            //        var itemUrl = $(currentMenuItem).attr('href');
1558            //        var itemText = $(currentMenuItem).text();
1559            //
1560            //        var liItem = $('<li />', {class: 'mkdf-previous-level'});
1561            //
1562            //        $('<a />', {
1563            //            'href': itemUrl,
1564            //            'html': '<i class="mkdf-vertical-slide-arrow fa fa-angle-left"></i>' + itemText
1565            //        }).appendTo(liItem);
1566            //
1567            //        if(elementToExpand.hasClass('second')) {
1568            //            elementToExpand.find('> div > ul').prepend(liItem);
1569            //        } else {
1570            //            elementToExpand.prepend(liItem);
1571            //        }
1572            //    }
1573            //}
1574        };
1575
1576        /**
1577         * Initializes scrolling in vertical area. It checks if vertical area is scrollable before doing so
1578         */
1579        //var initVerticalAreaScroll = function() {
1580        //    if(verticalAreaScrollable()) {
1581        //        verticalMenuObject.niceScroll({
1582        //            scrollspeed: 60,
1583        //            mousescrollstep: 40,
1584        //            cursorwidth: 0,
1585        //            cursorborder: 0,
1586        //            cursorborderradius: 0,
1587        //            cursorcolor: "transparent",
1588        //            autohidemode: false,
1589        //            horizrailenabled: false
1590        //        });
1591        //    }
1592        //};
1593
1594        //var initHiddenVerticalArea = function() {
1595        //    var verticalLogo = $('.mkdf-vertical-area-bottom-logo');
1596        //    var verticalMenuOpener = verticalMenuObject.find('.mkdf-vertical-menu-hidden-button');
1597        //    var scrollPosition = 0;
1598        //
1599        //    verticalMenuOpener.on('click tap', function() {
1600        //        if(isVerticalAreaOpen()) {
1601        //            closeVerticalArea();
1602        //        } else {
1603        //            openVerticalArea();
1604        //        }
1605        //    });
1606        //
1607        //    //take click outside vertical left/right area and close it
1608        //    $j(verticalMenuObject).outclick({
1609        //        callback: function() {
1610        //            closeVerticalArea();
1611        //        }
1612        //    });
1613        //
1614        //    $(window).scroll(function() {
1615        //        if(Math.abs($(window).scrollTop() - scrollPosition) > 400){
1616        //            closeVerticalArea();
1617        //        }
1618        //    });
1619        //
1620        //    /**
1621        //     * Closes vertical menu area by removing 'active' class on that element
1622        //     */
1623        //    function closeVerticalArea() {
1624        //        verticalMenuObject.removeClass('active');
1625        //
1626        //        if(verticalLogo.length) {
1627        //            verticalLogo.removeClass('active');
1628        //        }
1629        //    }
1630        //
1631        //    /**
1632        //     * Opens vertical menu area by adding 'active' class on that element
1633        //     */
1634        //    function openVerticalArea() {
1635        //        verticalMenuObject.addClass('active');
1636        //
1637        //        if(verticalLogo.length) {
1638        //            verticalLogo.addClass('active');
1639        //        }
1640        //
1641        //        scrollPosition = $(window).scrollTop();
1642        //    }
1643        //
1644        //    function isVerticalAreaOpen() {
1645        //        return verticalMenuObject.hasClass('active');
1646        //    }
1647        //};
1648
1649        return {
1650            /**
1651             * Calls all necessary functionality for vertical menu area if vertical area object is valid
1652             */
1653            init: function() {
1654                if(verticalMenuObject.length) {
1655                    initNavigation();
1656                    //initVerticalAreaScroll();
1657                    //
1658                    //if(mkdf.body.hasClass('mkdf-vertical-header-hidden')) {
1659                    //    initHiddenVerticalArea();
1660                    //}
1661                }
1662            }
1663        };
1664    };
1665
1666})(jQuery);
1667(function($) {
1668    "use strict";
1669
1670    var title = {};
1671    mkdf.modules.title = title;
1672
1673    title.mkdfParallaxTitle = mkdfParallaxTitle;
1674
1675    $(document).ready(function() {
1676        mkdfParallaxTitle();
1677    });
1678
1679    $(window).on('load', function() {
1680
1681
1682    });
1683
1684    $(window).resize(function() {
1685
1686    });
1687
1688    /*
1689     **	Title image with parallax effect
1690     */
1691    function mkdfParallaxTitle(){
1692        if($('.mkdf-title.mkdf-has-parallax-background').length > 0 && $('.touch').length === 0){
1693
1694            var parallaxBackground = $('.mkdf-title.mkdf-has-parallax-background');
1695            var parallaxBackgroundWithZoomOut = $('.mkdf-title.mkdf-has-parallax-background.mkdf-zoom-out');
1696
1697            var backgroundSizeWidth = parseInt(parallaxBackground.data('background-width'));
1698            
1699            var titleHolderHeight = parallaxBackground.data('height');
1700            var titleRate = (titleHolderHeight / 10000) * 7;
1701            var titleYPos = -(mkdf.scroll * titleRate);
1702
1703            //set position of background on doc ready
1704            parallaxBackground.css({'background-position': 'center '+ (titleYPos+mkdfGlobalVars.vars.mkdfAddForAdminBar) +'px' });
1705            parallaxBackgroundWithZoomOut.css({'background-size': backgroundSizeWidth-mkdf.scroll + 'px auto'});
1706
1707            //set position of background on window scroll
1708            $(window).scroll(function() {
1709                titleYPos = -(mkdf.scroll * titleRate);
1710                parallaxBackground.css({'background-position': 'center ' + (titleYPos+mkdfGlobalVars.vars.mkdfAddForAdminBar) + 'px' });
1711                parallaxBackgroundWithZoomOut.css({'background-size': backgroundSizeWidth-mkdf.scroll + 'px auto'});
1712            });
1713
1714        }
1715    }
1716
1717})(jQuery);
1718
1719(function($) {
1720    'use strict';
1721
1722    var shortcodes = {};
1723
1724    mkdf.modules.shortcodes = shortcodes;
1725
1726    shortcodes.mkdfInitCounter = mkdfInitCounter;
1727    shortcodes.mkdfInitProgressBars = mkdfInitProgressBars;
1728    shortcodes.mkdfInitShapeSeparator = mkdfInitShapeSeparator;
1729    shortcodes.mkdfInitCountdown = mkdfInitCountdown;
1730    shortcodes.mkdfInitMessages = mkdfInitMessages;
1731    shortcodes.mkdfInitMessageHeight = mkdfInitMessageHeight;
1732    shortcodes.mkdfInitTestimonials = mkdfInitTestimonialsCarousel;
1733    shortcodes.mkdfInitTextSlider = mkdfInitTextSlider;
1734    shortcodes.mkdfInitTestimonialsSlider = mkdfInitTestimonialsSlider;
1735    shortcodes.mkdfInitCarousels = mkdfInitCarousels;
1736    shortcodes.mkdfInitPieChartDoughnut = mkdfInitPieChartDoughnut;
1737    shortcodes.mkdfInitTabs = mkdfInitTabs;
1738    shortcodes.mkdfInitTabIcons = mkdfInitTabIcons;
1739    shortcodes.mkdfInitBlogListMasonry = mkdfInitBlogListMasonry;
1740    shortcodes.mkdfCustomFontResize = mkdfCustomFontResize;
1741    shortcodes.mkdfInitImageGallery = mkdfInitImageGallery;
1742    shortcodes.mkdfInitAccordions = mkdfInitAccordions;
1743    shortcodes.mkdfShowGoogleMap = mkdfShowGoogleMap;
1744    shortcodes.mkdfCheckSliderForHeaderStyle = mkdfCheckSliderForHeaderStyle;
1745
1746    $(document).ready(function() {
1747        mkdfInitCounter();
1748        mkdfInitProgressBars();
1749        mkdfInitShapeSeparator();
1750        mkdfInitCountdown();
1751        mkdfIcon().init();
1752        mkdfInitMessages();
1753        mkdfInitMessageHeight();
1754        mkdfInitTestimonialsCarousel();
1755        mkdfInitTextSlider();
1756        mkdfInitTestimonialsSlider();
1757        mkdfInitCarousels();
1758        mkdfInitPieChartDoughnut();
1759		mkdfInitTabs();
1760        mkdfInitTabIcons();
1761        mkdfButton().init();
1762        mkdfInitBlogListMasonry();
1763		mkdfCustomFontResize();
1764        mkdfInitImageGallery();
1765        mkdfInitAccordions();
1766        mkdfShowGoogleMap();
1767        mkdfTwitterSlider();
1768        mkdfBlogCarousel();
1769        mkdfInfoCardSlider();
1770        mkdfIconSlider();
1771        mkdfSocialShareOpenerBlogCarousel();
1772        mkdfSlider().init();
1773        mkdfTabbedGallery().init();
1774    });
1775    
1776    $(window).resize(function() {
1777        mkdfInitBlogListMasonry();
1778		mkdfCustomFontResize();
1779    });
1780
1781    $(window).on('load', function() {
1782    });
1783
1784    /**
1785     * Counter Shortcode
1786     */
1787    function mkdfInitCounter() {
1788
1789        var counters = $('.mkdf-counter');
1790
1791
1792        if (counters.length) {
1793            counters.each(function() {
1794                var counter = $(this);
1795                counter.appear(function() {
1796                    counter.parent().addClass('mkdf-counter-holder-show');
1797
1798                    //Counter zero type
1799                    if (counter.hasClass('zero')) {
1800                        var max = parseFloat(counter.text());
1801                        counter.countTo({
1802                            from: 0,
1803                            to: max,
1804                            speed: 1500,
1805                            refreshInterval: 100
1806                        });
1807                    } else {
1808                        counter.absoluteCounter({
1809                            speed: 2000,
1810                            fadeInDelay: 1000
1811                        });
1812                    }
1813
1814                },{accX: 0, accY: mkdfGlobalVars.vars.mkdfElementAppearAmount});
1815            });
1816        }
1817
1818    }
1819    
1820        /*
1821    **	Horizontal progress bars shortcode
1822    */
1823    function mkdfInitProgressBars(){
1824        
1825        var progressBar = $('.mkdf-progress-bar');
1826        
1827        if(progressBar.length){
1828            
1829            progressBar.each(function() {
1830                
1831                var thisBar = $(this);
1832                
1833                thisBar.appear(function() {
1834                    mkdfInitToCounterProgressBar(thisBar);
1835                    if(thisBar.find('.mkdf-floating.mkdf-floating-inside') !== 0){
1836                        var floatingInsideMargin = thisBar.find('.mkdf-progress-content').height();
1837                        floatingInsideMargin += parseFloat(thisBar.find('.mkdf-progress-title-holder').css('padding-bottom'));
1838                        floatingInsideMargin += parseFloat(thisBar.find('.mkdf-progress-title-holder').css('margin-bottom'));
1839                        thisBar.find('.mkdf-floating-inside').css('margin-bottom',-(floatingInsideMargin)+'px');
1840                    }
1841                    var percentage = thisBar.find('.mkdf-progress-content').data('percentage'),
1842                        progressContent = thisBar.find('.mkdf-progress-content'),
1843                        progressNumber = thisBar.find('.mkdf-progress-number');
1844
1845                    progressContent.css('width', '0%');
1846                    progressContent.animate({'width': percentage+'%'}, 1500);
1847                    progressNumber.css('left', '0%');
1848                    progressNumber.animate({'left': percentage+'%'}, 1500);
1849
1850                });
1851            });
1852        }
1853    }
1854    /*
1855    **	Counter for horizontal progress bars percent from zero to defined percent
1856    */
1857    function mkdfInitToCounterProgressBar(progressBar){
1858        var percentage = parseFloat(progressBar.find('.mkdf-progress-content').data('percentage'));
1859        var percent = progressBar.find('.mkdf-progress-number .mkdf-percent');
1860        if(percent.length) {
1861            percent.each(function() {
1862                var thisPercent = $(this);
1863                thisPercent.parents('.mkdf-progress-number-wrapper').css('opacity', '1');
1864                thisPercent.countTo({
1865                    from: 0,
1866                    to: percentage,
1867                    speed: 1500,
1868                    refreshInterval: 50
1869                });
1870            });
1871        }
1872    }
1873    
1874    /*
1875    **	Function to close message shortcode
1876    */
1877    function mkdfInitMessages(){
1878        var message = $('.mkdf-message');
1879        if(message.length){
1880            message.each(function(){
1881                var thisMessage = $(this);
1882                thisMessage.find('.mkdf-close').on('click',function(e){
1883                    e.preventDefault();
1884                    $(this).parent().parent().fadeOut(500);
1885                });
1886            });
1887        }
1888    }
1889    
1890    /*
1891    **	Init message height
1892    */
1893   function mkdfInitMessageHeight(){
1894       var message = $('.mkdf-message.mkdf-with-icon');
1895       if(message.length){
1896           message.each(function(){
1897               var thisMessage = $(this);
1898               var textHolderHeight = thisMessage.find('.mkdf-message-text-holder').height();
1899               var iconHolderHeight = thisMessage.find('.mkdf-message-icon-holder').height();
1900               
1901               if(textHolderHeight >
1901 iconHolderHeight) {
1902                   thisMessage.find('.mkdf-message-icon-holder').height(textHolderHeight);
1903               } else {
1904                   thisMessage.find('.mkdf-message-text-holder').height(iconHolderHeight);
1905               }
1906           });
1907       }
1908   }
1909
1910   /*
1911   **   Init shape separator
1912   */
1913   function mkdfInitShapeSeparator() {
1914
1915       var shapeSeparator = $('.mkdf-shape-separator.appear');
1916
1917
1918       if (shapeSeparator.length) {
1919           shapeSeparator.each(function() {
1920               $(this).appear(function() {
1921
1922                   $(this).find('span[class$="line"]').addClass('appeared');
1923
1924               },{accX: 0, accY: mkdfGlobalVars.vars.mkdfElementAppearAmount});
1925           });
1926       }
1927
1928   }
1929
1930    /**
1931     * Countdown Shortcode
1932     */
1933    function mkdfInitCountdown() {
1934
1935        var countdowns = $('.mkdf-countdown'),
1936            date = new Date(),
1937            currentMonth = date.getMonth(),
1938            currentYear = date.getFullYear(),
1939            year,
1940            month,
1941            day,
1942            hour,
1943            minute,
1944            timezone,
1945            monthLabel,
1946            dayLabel,
1947            hourLabel,
1948            minuteLabel,
1949            secondLabel;
1950
1951        if (countdowns.length) {
1952
1953            countdowns.each(function(){
1954
1955                //Find countdown elements by id-s
1956                var countdownId = $(this).attr('id'),
1957                    countdown = $('#'+countdownId),
1958                    digitFontSize,
1959                    labelFontSize;
1960
1961                //Get data for countdown
1962                year = countdown.data('year');
1963                month = countdown.data('month');
1964                day = countdown.data('day');
1965                hour = countdown.data('hour');
1966                minute = countdown.data('minute');
1967                timezone = countdown.data('timezone');
1968                monthLabel = countdown.data('month-label');
1969                dayLabel = countdown.data('day-label');
1970                hourLabel = countdown.data('hour-label');
1971                minuteLabel = countdown.data('minute-label');
1972                secondLabel = countdown.data('second-label');
1973                digitFontSize = countdown.data('digit-size');
1974                labelFontSize = countdown.data('label-size');
1975
1976                if( currentMonth !== month || currentYear !== year ) {
1977                    month = month - 1;
1978                }
1979
1980                //Initialize countdown
1981                countdown.countdown({
1982                    until: new Date(year, month, day, hour, minute, 44),
1983                    labels: ['Years', monthLabel, 'Weeks', dayLabel, hourLabel, minuteLabel, secondLabel],
1984                    format: 'ODHMS',
1985                    timezone: timezone,
1986                    padZeroes: true,
1987                    onTick: setCountdownStyle
1988                });
1989
1990                function setCountdownStyle() {
1991                    countdown.find('.countdown-amount').css({
1992                        'font-size' : digitFontSize+'px',
1993                        'line-height' : digitFontSize+'px'
1994                    });
1995                    countdown.find('.countdown-period').css({
1996                        'font-size' : labelFontSize+'px'
1997                    });
1998                }
1999
2000            });
2001
2002        }
2003
2004    }
2005
2006    /**
2007     * Object that represents icon shortcode
2008     * @returns {{init: Function}} function that initializes icon's functionality
2009     */
2010    var mkdfIcon = mkdf.modules.shortcodes.mkdfIcon = function() {
2011        //get all icons on page
2012        var icons = $('.mkdf-icon-shortcode');
2013
2014        /**
2015         * Function that triggers icon animation and icon animation delay
2016         */
2017        var iconAnimation = function(icon) {
2018            if(icon.hasClass('mkdf-icon-animation')) {
2019                icon.appear(function() {
2020                    icon.parent('.mkdf-icon-animation-holder').addClass('mkdf-icon-animation-show');
2021                }, {accX: 0, accY: mkdfGlobalVars.vars.mkdfElementAppearAmount});
2022            }
2023        };
2024
2025        /**
2026         * Function that triggers icon hover color functionality
2027         */
2028        var iconHoverColor = function(icon) {
2029            if(typeof icon.data('hover-color') !== 'undefined') {
2030                var changeIconColor = function(event) {
2031                    event.data.icon.css('color', event.data.color);
2032                };
2033
2034                var iconElement = icon.find('.mkdf-icon-element');
2035                var hoverColor = icon.data('hover-color');
2036                var originalColor = iconElement.css('color');
2037
2038                if(hoverColor !== '') {
2039                    icon.on('mouseenter', {icon: iconElement, color: hoverColor}, changeIconColor);
2040                    icon.on('mouseleave', {icon: iconElement, color: originalColor}, changeIconColor);
2041                }
2042            }
2043        };
2044
2045        /**
2046         * Function that triggers icon holder background color hover functionality
2047         */
2048        var iconHolderBackgroundHover = function(icon) {
2049            if(typeof icon.data('hover-background-color') !== 'undefined') {
2050                var changeIconBgColor = function(event) {
2051                    event.data.icon.css('background-color', event.data.color);
2052                };
2053
2054                var hoverBackgroundColor = icon.data('hover-background-color');
2055                var originalBackgroundColor = icon.css('background-color');
2056
2057                if(hoverBackgroundColor !== '') {
2058                    icon.on('mouseenter', {icon: icon, color: hoverBackgroundColor}, changeIconBgColor);
2059                    icon.on('mouseleave', {icon: icon, color: originalBackgroundColor}, changeIconBgColor);
2060                }
2061            }
2062        };
2063
2064        /**
2065         * Function that initializes icon holder border hover functionality
2066         */
2067        var iconHolderBorderHover = function(icon) {
2068            if(typeof icon.data('hover-border-color') !== 'undefined') {
2069                var changeIconBorder = function(event) {
2070                    event.data.icon.css('border-color', event.data.color);
2071                };
2072
2073                var hoverBorderColor = icon.data('hover-border-color');
2074                var originalBorderColor = icon.css('border-color');
2075
2076                if(hoverBorderColor !== '') {
2077                    icon.on('mouseenter', {icon: icon, color: hoverBorderColor}, changeIconBorder);
2078                    icon.on('mouseleave', {icon: icon, color: originalBorderColor}, changeIconBorder);
2079                }
2080            }
2081        };
2082
2083        return {
2084            init: function() {
2085                if(icons.length) {
2086                    icons.each(function() {
2087                        iconAnimation($(this));
2088                        iconHoverColor($(this));
2089                        iconHolderBackgroundHover($(this));
2090                        iconHolderBorderHover($(this));
2091                    });
2092
2093                }
2094            }
2095        };
2096    };
2097
2098    /**
2099     * Init Text Slider shortcode
2100     */
2101    function mkdfInitTextSlider(){
2102
2103        var text_slider = $('.mkdf-text-slider-container-inner');
2104        if(text_slider.length){
2105            text_slider.each(function(){
2106                var thisTextSlider = $(this);
2107
2108                thisTextSlider.appear(function() {
2109                    thisTextSlider.css('visibility','visible');
2110                },{accX: 0, accY: mkdfGlobalVars.vars.mkdfElementAppearAmount});
2111
2112                thisTextSlider.owlCarousel({
2113                    singleItem: true,
2114                    autoPlay: false,
2115                    autoHeight: true,
2116                    navigation: false,
2117                    slideSpeed: 800,
2118                    pagination: true,
2119                    paginationNumbers: true
2120                });
2121
2122            });
2123
2124        }
2125
2126    }
2127
2128    /**
2129     * Init testimonials slider shortcode
2130     */
2131    function mkdfInitTestimonialsSlider(){
2132
2133        var testimonial = $('.mkdf-testimonials-slider .mkdf-testimonials');
2134        if(testimonial.length){
2135            testimonial.each(function(){
2136                var thisTestimonial = $(this);
2137                var autoplay = 10000;
2138                if(typeof thisTestimonial.data('autoplay') !== 'undefined' && thisTestimonial.data('autoplay') == 'no') {
2139                    autoplay = false;
2140                }
2141
2142                thisTestimonial.appear(function() {
2143                    thisTestimonial.css('visibility','visible');
2144                },{accX: 0, accY: mkdfGlobalVars.vars.mkdfElementAppearAmount});
2145
2146                thisTestimonial.owlCarousel({
2147                    singleItem: true,
2148                    autoPlay: autoplay,
2149                    transitionStyle : 'fade', //fade, fadeUp, backSlide, goDown
2150                    autoHeight: true,
2151                    navigation: true,
2152                    slideSpeed: 600,
2153                    pagination: false,
2154                    navigationText: [
2155                        '<span class="mkdf-prev-icon"><i class="arrow_carrot-left"></i></span>',
2156                        '<span class="mkdf-next-icon"><i class="arrow_carrot-right"></i></span>'
2157                    ]
2158                });
2159
2160            });
2161
2162        }
2163
2164    }
2165
2166    /**
2167     * Init testimonials carousel shortcode
2168     */
2169    function mkdfInitTestimonialsCarousel() {
2170
2171        var testimonial = $('.mkdf-testimonials-carousel .mkdf-testimonials');
2172        if(testimonial.length){
2173            testimonial.each(function(){
2174                var thisTestimonial = $(this);
2175                var autoplay = false;
2176                if(typeof thisTestimonial.data('autoplay') !== 'undefined' && thisTestimonial.data('autoplay') == 'yes') {
2177                    autoplay = 3000;
2178                }
2179
2180                thisTestimonial.appear(function() {
2181                    thisTestimonial.css('visibility','visible');
2182                },{accX: 0, accY: mkdfGlobalVars.vars.mkdfElementAppearAmount});
2183
2184                var showNav = thisTestimonial.data('show-navigation');
2185                if(typeof showNav !== 'undefined') {
2186                    showNav = showNav == 'yes';
2187                } else {
2188                    showNav = true;
2189                }
2190
2191                thisTestimonial.owlCarousel({
2192                    items: 3,
2193                    itemsDesktopSmall: [1200, 3],
2194                    itemsTablet: [768, 2],
2195                    itemsTabletSmall: [600, 1],
2196                    itemsMobile: [480, 1],
2197                    autoHeight: false,
2198                    slideSpeed: 600,
2199                    pagination: showNav,
2200                    navigation: false,
2201                    autoPlay: autoplay
2202                });
2203            });
2204
2205        }
2206
2207    }
2208
2209    /**
2210     * Init Carousel shortcode
2211     */
2212    function mkdfInitCarousels() {
2213
2214        var carouselHolders = $('.mkdf-carousel-holder'),
2215            carousel,
2216            numberOfItems,
2217            navigation;
2218
2219        if (carouselHolders.length) {
2220            carouselHolders.each(function() {
2221                carousel = carouselHolders.children('.mkdf-carousel');
2222                numberOfItems = carousel.data('items');
2223                navigation = carousel.data('navigation') === 'yes';
2224
2225                //Responsive breakpoints
2226                var items = [
2227                    [0,1],
2228                    [480,2],
2229                    [768,3],
2230                    [1024,numberOfItems]
2231                ];
2232
2233                carousel.owlCarousel({
2234                    autoPlay: false,
2235                    items: numberOfItems,
2236                    itemsCustom: items,
2237                    pagination: navigation,
2238                    navigation: false,
2239                    slideSpeed: 600,
2240                    navigationText: [
2241                        '<span class="mkdf-prev-icon"><i class="fa fa-angle-left"></i></span>',
2242                        '<span class="mkdf-next-icon"><i class="fa fa-angle-right"></i></span>'
2243                    ]
2244                });
2245
2246            });
2247        }
2248
2249    }
2250
2251    /*
2252     **	Counter for pie chart number from zero to defined number
2253     */
2254    function initToCounterPieChart( pieChart ){
2255
2256        pieChart.css('opacity', '1');
2257        var counter = pieChart.find('.mkdf-to-counter'),
2258            max = parseFloat(counter.text());
2259        counter.countTo({
2260            from: 0,
2261            to: max,
2262            speed: 1500,
2263            refreshInterval: 50
2264        });
2265
2266    }
2267
2268    /**
2269     * Init Pie Chart shortcode
2270     */
2271    function mkdfInitPieChartDoughnut() {
2272
2273        var pieCharts = $('.mkdf-pie-chart-doughnut-holder, .mkdf-pie-chart-pie-holder');
2274
2275        pieCharts.each(function(){
2276
2277            var pieChart = $(this),
2278                canvas = pieChart.find('canvas'),
2279                chartID = canvas.attr('id'),
2280                chart = document.getElementById(chartID).getContext('2d'),
2281                data = [],
2282                jqChart = $(chart.canvas); //Convert canvas to JQuery object and get data parameters
2283
2284            for (var i = 1; i<=10; i++) {
2285
2286                var chartItem,
2287                    value = jqChart.data('value-' + i),
2288                    color = jqChart.data('color-' + i);
2289                
2290                if (typeof value !== 'undefined' && typeof color !== 'undefined' ) {
2291                    chartItem = {
2292                        value : value,
2293                        color : color
2294                    };
2295                    data.push(chartItem);
2296                }
2297
2298            }
2299
2300            if (canvas.hasClass('mkdf-pie')) {
2301                new Chart(chart).Pie(data,
2302                    {segmentStrokeColor : 'transparent'}
2303                );
2304            } else {
2305                new Chart(chart).Doughnut(data,
2306                    {segmentStrokeColor : 'transparent'}
2307                );
2308            }
2309
2310        });
2311
2312    }
2313
2314    /*
2315    **	Init tabs shortcode
2316    */
2317    function mkdfInitTabs(){
2318
2319       var tabs = $('.mkdf-tabs');
2320        if(tabs.length){
2321            tabs.each(function(){
2322                var thisTabs = $(this);
2323
2324                if(thisTabs.hasClass('mkdf-horizontal')){
2325                    thisTabs.tabs();
2326                }
2327                else if(thisTabs.hasClass('mkdf-vertical')){
2328                    thisTabs.tabs().addClass( 'ui-tabs-vertical ui-helper-clearfix' );
2329                    thisTabs.find('.mkdf-tabs-nav > ul >li').removeClass( 'ui-corner-top' ).addClass( 'ui-corner-left' );
2330                }
2331            });
2332        }
2333    }
2334
2335    /*
2336    **	Generate icons in tabs navigation
2337    */
2338    function mkdfInitTabIcons(){
2339
2340        var tabContent = $('.mkdf-tab-container');
2341        if(tabContent.length){
2342
2343            tabContent.each(function(){
2344                var thisTabContent = $(this);
2345
2346                var id = thisTabContent.attr('id');
2347                var icon = '';
2348                if(typeof thisTabContent.data('icon-html') !== 'undefined' || thisTabContent.data('icon-html') !== 'false') {
2349                    icon = thisTabContent.data('icon-html');
2350                }
2351
2352                var tabNav = thisTabContent.parents('.mkdf-tabs').find('.mkdf-tabs-nav > li > a[href="#'+id+'"]');
2353
2354                if(typeof(tabNav) !== 'undefined') {
2355                    tabNav.children('.mkdf-icon-frame').append(icon);
2356                }
2357            });
2358        }
2359    }
2360
2361    /**
2362     * Button object that initializes whole button functionality
2363     * @type {Function}
2364     */
2365    var mkdfButton = mkdf.modules.shortcodes.mkdfButton = function() {
2366        //all buttons on the page
2367        var buttons = $('.mkdf-btn');
2368
2369        /**
2370         * Initializes button hover color
2371         * @param button current button
2372         */
2373        var buttonHoverColor = function(button) {
2374            if(typeof button.data('hover-color') !== 'undefined') {
2375                var changeButtonColor = function(event) {
2376                    event.data.button.css('color', event.data.color);
2377                };
2378
2379                var originalColor = button.css('color');
2380                var hoverColor = button.data('hover-color');
2381
2382                button.on('mouseenter', { button: button, color: hoverColor }, changeButtonColor);
2383                button.on('mouseleave', { button: button, color: originalColor }, changeButtonColor);
2384            }
2385        };
2386
2387
2388
2389        /**
2390         * Initializes button hover background color
2391         * @param button current button
2392         */
2393        var buttonHoverBgColor = function(button) {
2394            if(typeof button.data('hover-bg-color') !== 'undefined') {
2395                var changeButtonBg = function(event) {
2396                    event.data.button.css('background-color', event.data.color);
2397                };
2398
2399                var originalBgColor = button.css('background-color');
2400                var hoverBgColor = button.data('hover-bg-color');
2401
2402                button.on('mouseenter', { button: button, color: hoverBgColor }, changeButtonBg);
2403                button.on('mouseleave', { button: button, color: originalBgColor }, changeButtonBg);
2404            }
2405        };
2406
2407        /**
2408         * Initializes button border color
2409         * @param button
2410         */
2411        var buttonHoverBorderColor = function(button) {
2412            if(typeof button.data('hover-border-color') !== 'undefined') {
2413                var changeBorderColor = function(event) {
2414                    event.data.button.css('border-color', event.data.color);
2415                };
2416
2417                var originalBorderColor = button.css('border-color');
2418                var hoverBorderColor = button.data('hover-border-color');
2419
2420                button.on('mouseenter', { button: button, color: hoverBorderColor }, changeBorderColor);
2421                button.on('mouseleave', { button: button, color: originalBorderColor }, changeBorderColor);
2422            }
2423        };
2424
2425        var buttonIconHoverBorderColor = function(button) {
2426            if(button.hasClass('mkdf-btn-icon')) {
2427                if(typeof button.data('icon-hover-border-color') !== 'undefined') {
2428                    var changeIconBorderColor = function(event) {
2429                        event.data.iconHolder.css('border-color', event.data.color);
2430                    };
2431
2432                    var iconHolder = button.find('.mkdf-btn-icon-holder');
2433
2434                    var originalBorderColor = iconHolder.css('borderRightColor');
2435                    var hoverBorderColor = button.data('icon-hover-border-color');
2436
2437                    button.on('mouseenter', { iconHolder: iconHolder, color: hoverBorderColor }, changeIconBorderColor);
2438                    button.on('mouseleave', { iconHolder: iconHolder, color: originalBorderColor }, changeIconBorderColor);
2439                }
2440            }
2441        }
2442
2443        return {
2444            init: function() {
2445                if(buttons.length) {
2446                    buttons.each(function() {
2447                        buttonHoverColor($(this));
2448                        buttonHoverBgColor($(this));
2449                        buttonHoverBorderColor($(this));
2450                        buttonIconHoverBorderColor($(this));
2451                    });
2452                }
2453            }
2454        };
2455    };
2456    
2457    /*
2458    **	Init blog list masonry type
2459    */
2460    function mkdfInitBlogListMasonry(){
2461        var blogList = $('.mkdf-blog-list-holder.mkdf-masonry .mkdf-blog-list');
2462        if(blogList.length) {
2463            blogList.each(function() {
2464                var thisBlogList = $(this);
2465                thisBlogList.animate({opacity: 1});
2466                thisBlogList.isotope({
2467                    itemSelector: '.mkdf-blog-list-masonry-item',
2468                    masonry: {
2469                        columnWidth: '.mkdf-blog-list-masonry-grid-sizer',
2470                        gutter: '.mkdf-blog-list-masonry-grid-gutter'
2471                    }
2472                });
2473            });
2474
2475        }
2476    }
2477
2478	/*
2479	**	Custom Font resizing
2480	*/
2481	function mkdfCustomFontResize(){
2482		var customFont = $('.mkdf-custom-font-holder');
2483		if (customFont.length){
2484			customFont.each(function(){
2485				var thisCustomFont = $(this);
2486				var fontSize;
2487				var lineHeight;
2488				var coef1 = 1;
2489				var coef2 = 1;
2490
2491				if (mkdf.windowWidth < 1200){
2492					coef1 = 0.8;
2493				}
2494
2495				if (mkdf.windowWidth < 1000){
2496					coef1 = 0.7;
2497				}
2498
2499				if (mkdf.windowWidth < 768){
2500					coef1 = 0.6;
2501					coef2 = 0.7;
2502				}
2503
2504				if (mkdf.windowWidth < 600){
2505					coef1 = 0.5;
2506					coef2 = 0.6;
2507				}
2508
2509				if (mkdf.windowWidth < 480){
2510					coef1 = 0.4;
2511					coef2 = 0.5;
2512				}
2513
2514				if (typeof thisCustomFont.data('font-size') !== 'undefined' && thisCustomFont.data('font-size') !== false) {
2515					fontSize = parseInt(thisCustomFont.data('font-size'));
2516
2517					if (fontSize > 70) {
2518						fontSize = Math.round(fontSize*coef1);
2519					}
2520					else if (fontSize > 35) {
2521						fontSize = Math.round(fontSize*coef2);
2522					}
2523
2524					thisCustomFont.css('font-size',fontSize + 'px');
2525				}
2526
2527				if (typeof thisCustomFont.data('line-height') !== 'undefined' && thisCustomFont.data('line-height') !== false) {
2528					lineHeight = parseInt(thisCustomFont.data('line-height'));
2529
2530					if (lineHeight > 70 && mkdf.windowWidth < 1200) {
2531						lineHeight = '1.2em';
2532					}
2533					else if (lineHeight > 35 && mkdf.windowWidth < 768) {
2534						lineHeight = '1.2em';
2535					}
2536					else{
2537						lineHeight += 'px';
2538					}
2539
2540					thisCustomFont.css('line-height', lineHeight);
2541				}
2542			});
2543		}
2544	}
2545
2546    /*
2547     **	Show Google Map
2548     */
2549    function mkdfShowGoogleMap(){
2550
2551        if($('.mkdf-google-map').length){
2552            $('.mkdf-google-map').each(function(){
2553
2554                var element = $(this);
2555
2556                var customMapStyle;
2557                if(typeof element.data('custom-map-style') !== 'undefined') {
2558                    customMapStyle = element.data('custom-map-style');
2559                }
2560
2561                var colorOverlay;
2562                if(typeof element.data('color-overlay') !== 'undefined' && element.data('color-overlay') !== false) {
2563                    colorOverlay = element.data('color-overlay');
2564                }
2565
2566                var saturation;
2567                if(typeof element.data('saturation') !== 'undefined' && element.data('saturation') !== false) {
2568                    saturation = element.data('saturation');
2569                }
2570
2571                var lightness;
2572                if(typeof element.data('lightness') !== 'undefined' && element.data('lightness') !== false) {
2573                    lightness = element.data('lightness');
2574                }
2575
2576                var zoom;
2577                if(typeof element.data('zoom') !== 'undefined' && element.data('zoom') !== false) {
2578                    zoom = element.data('zoom');
2579                }
2580
2581                var pin;
2582                if(typeof element.data('pin') !== 'undefined' && element.data('pin') !== false) {
2583                    pin = element.data('pin');
2584                }
2585
2586                var mapHeight;
2587                if(typeof element.data('height') !== 'undefined' && element.data('height') !== false) {
2588                    mapHeight = element.data('height');
2589                }
2590
2591                var uniqueId;
2592                if(typeof element.data('unique-id') !== 'undefined' && element.data('unique-id') !== false) {
2593                    uniqueId = element.data('unique-id');
2594                }
2595
2596                var scrollWheel;
2597                if(typeof element.data('scroll-wheel') !== 'undefined') {
2598                    scrollWheel = element.data('scroll-wheel');
2599                }
2600                var addresses;
2601                if(typeof element.data('addresses') !== 'undefined' && element.data('addresses') !== false) {
2602                    addresses = element.data('addresses');
2603                }
2604
2605                var map = "map_"+ uniqueId;
2606                var geocoder = "geocoder_"+ uniqueId;
2607                var holderId = "mkdf-map-"+ uniqueId;
2608
2609                mkdfInitializeGoogleMap(customMapStyle, colorOverlay, saturation, lightness, scrollWheel, zoom, holderId, mapHeight, pin,  map, geocoder, addresses);
2610            });
2611        }
2612
2613    }
2614    /*
2615     **	Init Google Map
2616     */
2617    function mkdfInitializeGoogleMap(customMapStyle, color, saturation, lightness, wheel, zoom, holderId, height, pin,  map, geocoder, data){
2618	
2619	    if(typeof google !== 'object') {
2620		    return;
2621	    }
2622        
2623        var mapStyles = [
2624            {
2625                stylers: [
2626                    {hue: color },
2627                    {saturation: saturation},
2628                    {lightness: lightness},
2629                    {gamma: 1}
2630                ]
2631            }
2632        ];
2633
2634        var googleMapStyleId;
2635
2636        if(customMapStyle){
2637            googleMapStyleId = 'mkdf-style';
2638        } else {
2639            googleMapStyleId = google.maps.MapTypeId.ROADMAP;
2640        }
2641
2642        var qoogleMapType = new google.maps.StyledMapType(mapStyles,
2643            {name: "Mikado Google Map"});
2644
2645        geocoder = new google.maps.Geocoder();
2646        var latlng = new google.maps.LatLng(-34.397, 150.644);
2647
2648        if (!isNaN(height)){
2649            height = height + 'px';
2650        }
2651
2652        var myOptions = {
2653
2654            zoom: zoom,
2655            scrollwheel: wheel,
2656            center: latlng,
2657            zoomControl: true,
2658            zoomControlOptions: {
2659                style: google.maps.ZoomControlStyle.SMALL,
2660                position: google.maps.ControlPosition.RIGHT_CENTER
2661            },
2662            scaleControl: false,
2663            scaleControlOptions: {
2664                position: google.maps.ControlPosition.LEFT_CENTER
2665            },
2666            streetViewControl: false,
2667            streetViewControlOptions: {
2668                position: google.maps.ControlPosition.LEFT_CENTER
2669            },
2670            panControl: false,
2671            panControlOptions: {
2672                position: google.maps.ControlPosition.LEFT_CENTER
2673            },
2674            mapTypeControl: false,
2675            mapTypeControlOptions: {
2676                mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'mkdf-style'],
2677                style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
2678                position: google.maps.ControlPosition.LEFT_CENTER
2679            },
2680            mapTypeId: googleMapStyleId
2681        };
2682
2683        map = new google.maps.Map(document.getElementById(holderId), myOptions);
2684        map.mapTypes.set('mkdf-style', qoogleMapType);
2685
2686        var index;
2687
2688        for (index = 0; index < data.length; ++index) {
2689            mkdfInitializeGoogleAddress(data[index], pin, map, geocoder);
2690        }
2691
2692        var holderElement = document.getElementById(holderId);
2693        holderElement.style.height = height;
2694    }
2695    /*
2696     **	Init Google Map Addresses
2697     */
2698    function mkdfInitializeGoogleAddress(data, pin,  map, geocoder){
2699        if (data === '')
2700            return;
2701        var contentString = '<div id="content">'+
2702            '<div id="siteNotice">'+
2703            '</div>'+
2704            '<div id="bodyContent">'+
2705            '<p>'+data+'</p>'+
2706            '</div>'+
2707            '</div>';
2708        var infowindow = new google.maps.InfoWindow({
2709            content: contentString
2710        });
2711        geocoder.geocode( { 'address': data}, function(results, status) {
2712            if (status === google.maps.GeocoderStatus.OK) {
2713                map.setCenter(results[0].geometry.location);
2714                var marker = new google.maps.Marker({
2715                    map: map,
2716                    position: results[0].geometry.location,
2717                    icon:  pin,
2718                    title: data['store_title']
2719                });
2720                google.maps.event.addListener(marker, 'click', function() {
2721                    infowindow.open(map,marker);
2722                });
2723
2724                google.maps.event.addDomListener(window, 'resize', function() {
2725                    map.setCenter(results[0].geometry.location);
2726                });
2727
2728            }
2729        });
2730    }
2731
2732    function mkdfInitAccordions(){
2733        var accordion = $('.mkdf-accordion-holder');
2734        if(accordion.length){
2735            accordion.each(function(){
2736
2737               var thisAccordion = $(this);
2738
2739				if(thisAccordion.hasClass('mkdf-accordion')){
2740
2741					thisAccordion.accordion({
2742						animate: "swing",
2743						collapsible: true,
2744						active: 0,
2745						icons: "",
2746						heightStyle: "content"
2747					});
2748				}
2749
2750				if(thisAccordion.hasClass('mkdf-toggle')){
2751
2752					var toggleAccordion = $(this);
2753					var toggleAccordionTitle = toggleAccordion.find('.mkdf-title-holder');
2754					var toggleAccordionContent = toggleAccordionTitle.next();
2755
2756					toggleAccordion.addClass("accordion ui-accordion ui-accordion-icons ui-widget ui-helper-reset");
2757					toggleAccordionTitle.addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom");
2758					toggleAccordionContent.addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide();
2759
2760					toggleAccordionTitle.each(function(){
2761						var thisTitle = $(this);
2762						thisTitle.on('mouseenter mouseleave',function(){
2763							thisTitle.toggleClass("ui-state-hover");
2764						});
2765
2766						thisTitle.on('click',function(){
2767							thisTitle.toggleClass('ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom');
2768							thisTitle.next().toggleClass('ui-accordion-content-active').slideToggle(400);
2769						});
2770					});
2771				}
2772            });
2773        }
2774    }
2775
2776    function mkdfInitImageGallery() {
2777
2778        var galleries = $('.mkdf-image-gallery');
2779
2780        if (galleries.length) {
2781            galleries.each(function () {
2782                var gallery = $(this).children('.mkdf-image-gallery-slider'),
2783                    autoplay = gallery.data('autoplay'),
2784                    animation = (gallery.data('animation') == 'slide') ? false : gallery.data('animation'),
2785                    navigation = (gallery.data('navigation') == 'yes'),
2786                    pagination = (gallery.data('pagination') == 'yes');
2787
2788                gallery.owlCarousel({
2789                    singleItem: true,
2790                    autoPlay: autoplay * 1000,
2791                    navigation: navigation,
2792                    transitionStyle : animation, //fade, fadeUp, backSlide, goDown
2793                    autoHeight: true,
2794                    pagination: pagination,
2795                    slideSpeed: 600,
2796                    navigationText: [
2797                        '<span class="mkdf-prev-icon"><i class="fa fa-angle-left"></i></span>',
2798                        '<span class="mkdf-next-icon"><i class="fa fa-angle-right"></i></span>'
2799                    ]
2800                });
2801            });
2802        }
2803
2804    }
2805    
2806    function mkdfConvertHTML ( html ) {
2807        var newHtml = $.trim( html ),
2808                $html = $(newHtml ),
2809                $empty = $();
2810
2811        $html.each(function ( index, value ) {
2812            if ( value.nodeType === 1) {
2813                $empty = $empty.add ( this );
2814            }
2815        });
2816
2817        return $empty;
2818    };
2819
2820    function mkdfTwitterSlider() {
2821        var twitterSliders = $('.mkdf-twitter-slider-inner');
2822
2823        if(twitterSliders.length) {
2824            twitterSliders.each(function() {
2825                var autoRotate = $(this).data('auto-rotate-slides');
2826                var autoplay = true;
2827                if(typeof autoRotate === 'undefined') {
2828                    autoRotate = false;
2829                    autoplay = false;
2830                }
2831
2832                var animationSpeed = $(this).data('animation-speed');
2833                if(typeof animationSpeed === 'undefined') {
2834                    animationSpeed = 500;
2835                }
2836
2837                $(this).owlCarousel({
2838                    items: 1,
2839                    itemsDesktop: false,
2840                    itemsDesktopSmall: false,
2841                    itemsTablet: false,
2842                    itemsTabletSmall: false,
2843                    itemsMobile: false,
2844                    autoplay: autoplay,
2845                    autoplayTimeout: autoRotate * 1000,
2846                    navSpeed: animationSpeed,
2847                    dragEndSpeed: animationSpeed
2848                });
2849            });
2850        }
2851    }
2852
2853    function mkdfBlogCarousel() {
2854        var blogCarousels = $('.mkdf-blog-carousel-inner');
2855
2856        if(blogCarousels.length) {
2857            blogCarousels.each(function() {
2858                var carouselHolder = $(this).parent('.mkdf-blog-carousel');
2859                var showNavigation = carouselHolder.data('show-navigation');
2860
2861                if(typeof showNavigation === 'undefined') {
2862                    showNavigation = true;
2863                } else {
2864                    showNavigation = showNavigation === 'yes';
2865                }
2866
2867                var showPagination = carouselHolder.data('show-pagination');
2868
2869                if(typeof showPagination === 'undefined') {
2870                    showPagination = true;
2871                } else {
2872                    showPagination = showPagination === 'yes';
2873                }
2874
2875                if(carouselHolder.data)
2876
2877                $(this).owlCarousel({
2878                    items: 3,
2879                    itemsCustom: [
2880                        [1200, 3],
2881                        [1000, 2],
2882                        [768, 2],
2883                        [600, 1],
2884                        [480, 1],
2885                        [320, 1]
2886                    ],
2887                    pagination: showPagination,
2888                    navigation: showNavigation,
2889                    navigationText: [
2890                        '<span class="mkdf-prev-icon"><i class="arrow_left"></i></span>',
2891                        '<span class="mkdf-next-icon"><i class="arrow_right"></i></span>'
2892                    ],
2893                    slideSpeed: 800
2894                });
2895            });
2896        }
2897    }
2898
2899    function mkdfInfoCardSlider() {
2900        var infoCardSliders = $('.mkdf-info-card-slider-holder');
2901
2902        if(infoCardSliders.length) {
2903            infoCardSliders.each(function() {
2904                $(this).owlCarousel({
2905                    items: 3,
2906                    itemsCustom: [
2907                        [1200, 3],
2908                        [1000, 2],
2909                        [768, 2],
2910                        [600, 1],
2911                        [480, 1],
2912                        [320, 1]
2913                    ],
2914                    pagination: true,
2915                    navigation: false,
2916                    slideSpeed: 800,
2917                    mouseDrag: false
2918                });
2919            });
2920        }
2921    }
2922
2923    function mkdfIconSlider() {
2924        var iconSliders = $('.mkdf-icon-slider-container');
2925
2926        if(iconSliders.length) {
2927            iconSliders.each(function() {
2928                $(this).flexslider({
2929                    animation: 'slide',
2930                    manualControls: '.mkdf-icon-slider-nav .mkdf-icon-slider-nav-item',
2931                    selector: '.mkdf-icon-slider-container-inner li',
2932                    directionNav: false
2933                });
2934            });
2935        }
2936    }
2937
2938    function mkdfSocialShareOpenerBlogCarousel() {
2939        var carouselHolders = $('.mkdf-blog-boxes-item-holder-outer');
2940
2941        if(carouselHolders.length) {
2942            carouselHolders.each(function() {
2943                var opener = $(this).find('.mkdf-social-share-dropdown-opener');
2944                var infoHolder = $(this).find('.mkdf-blog-boxes-info-inner')
2945                var shareDropdown = $(this).find('.mkdf-social-share-dropdown');
2946
2947                opener.on('click', function() {
2948                    shareDropdown.toggleClass('mkdf-social-share-dropdown-opened');
2949                    shareDropdown.is('.mkdf-social-share-dropdown-opened') ? infoHolder.addClass('mkdf-blog-boxes-info-hide') : infoHolder.removeClass('mkdf-blog-boxes-info-hide');
2950                });
2951            });
2952        }
2953    }
2954
2955    /**
2956     * Slider object that initializes whole slider functionality
2957     * @type {Function}
2958     */
2959    var mkdfSlider = mkdf.modules.shortcodes.mkdfSlider = function() {
2960
2961        //all sliders on the page
2962        var sliders = $('.mkdf-slider .carousel');
2963        //image regex used to extract img source
2964        var imageRegex = /url\(["']?([^'")]+)['"]?\)/;
2965        //default responsive breakpoints set
2966        var responsiveBreakpointSet = [1600,1200,900,650,500,320];
2967        //var init for coefficiens array
2968        var coefficientsGraphicArray;
2969        var coefficientsTitleArray;
2970        var coefficientsSubtitleArray;
2971        var coefficientsTextArray;
2972        var coefficientsButtonArray;
2973        //var init for slider elements responsive coefficients
2974        var sliderGraphicCoefficient;
2975        var sliderTitleCoefficient;
2976        var sliderSubtitleCoefficient;
2977        var sliderTextCoefficient;
2978        var sliderButtonCoefficient;
2979        var sliderTitleCoefficientLetterSpacing;
2980        var sliderSubtitleCoefficientLetterSpacing;
2981        var sliderTextCoefficientLetterSpacing;
2982
2983        /*** Functionality for translating image in slide - START ***/
2984
2985        var matrixArray = { zoom_center : '1.2, 0, 0, 1.2, 0, 0', zoom_top_left: '1.2, 0, 0, 1.2, -150, -150', zoom_top_right : '1.2, 0, 0, 1.2, 150, -150', zoom_bottom_left: '1.2, 0, 0, 1.2, -150, 150', zoom_bottom_right: '1.2, 0, 0, 1.2, 150, 150'};
2986
2987        // regular expression for parsing out the matrix components from the matrix string
2988        var matrixRE = /\([0-9epx\.\, \t\-]+/gi;
2989
2990        // parses a matrix string of the form "matrix(n1,n2,n3,n4,n5,n6)" and
2991        // returns an array with the matrix components
2992        var parseMatrix = function (val) {
2993            return val.match(matrixRE)[0].substr(1).
2994                split(",").map(function (s) {
2995                    return parseFloat(s);
2996                });
2997        };
2998
2999        // transform css property names with vendor prefixes;
3000        // the plugin will check for values in the order the names are listed here and return as soon as there
3001        // is a value; so listing the W3 std name for the transform results in that being used if its available
3002        var transformPropNames = [
3003            "transform",
3004            "-webkit-transform"
3005        ];
3006
3007        var getTransformMatrix = function (el) {
3008            // iterate through the css3 identifiers till we hit one that yields a value
3009            var matrix = null;
3010            transformPropNames.some(function (prop) {
3011                matrix = el.css(prop);
3012                return (matrix !== null && matrix !== "");
3013            });
3014
3015            // if "none" then we supplant it with an identity matrix so that our parsing code below doesn't break
3016            matrix = (!matrix || matrix === "none") ?
3017                "matrix(1,0,0,1,0,0)" : matrix;
3018            return parseMatrix(matrix);
3019        };
3020
3021        // set the given matrix transform on the element; note that we apply the css transforms in reverse order of how its given
3022        // in "transformPropName" to ensure that the std compliant prop name shows up last
3023        var setTransformMatrix = function (el, matrix) {
3024            var m = "matrix(" + matrix.join(",") + ")";
3025            for (var i = transformPropNames.length - 1; i >= 0; --i) {
3026                el.css(transformPropNames[i], m + ' rotate(0.01deg)');
3027            }
3028        };
3029
3030        // interpolates a value between a range given a percent
3031        var interpolate = function (from, to, percent) {
3032            return from + ((to - from) * (percent / 100));
3033        };
3034
3035        $.fn.transformAnimate = function (opt) {
3036            // extend the options passed in by caller
3037            var options = {
3038                transform: "matrix(1,0,0,1,0,0)"
3039            };
3040            $.extend(options, opt);
3041
3042            // initialize our custom property on the element to track animation progress
3043            this.css("percentAnim", 0);
3044
3045            // supplant "options.step" if it exists with our own routine
3046            var sourceTransform = getTransformMatrix(this);
3047            var targetTransform = parseMatrix(options.transform);
3048            options.step = function (percentAnim, fx) {
3049                // compute the interpolated transform matrix for the current animation progress
3050                var $this = $(this);
3051                var matrix = sourceTransform.map(function (c, i) {
3052                    return interpolate(c, targetTransform[i],
3053                        percentAnim);
3054                });
3055
3056                // apply the new matrix
3057                setTransformMatrix($this, matrix);
3058
3059                // invoke caller's version of "step" if one was supplied;
3060                if (opt.step) {
3061                    opt.step.apply(this, [matrix, fx]);
3062                }
3063            };
3064
3065            // animate!
3066            return this.stop().animate({ percentAnim: 100 }, options);
3067        };
3068
3069        /*** Functionality for translating image in slide - END ***/
3070
3071
3072        /**
3073         * Calculate heights for slider holder and slide item, depending on window width, but only if slider is set to be responsive
3074         * @param slider, current slider
3075         * @param defaultHeight, default height of slider, set in shortcode
3076         * @param responsive_breakpoint_set, breakpoints set for slider responsiveness
3077         * @param reset, boolean for reseting heights
3078         */
3079        var setSliderHeight = function(slider, defaultHeight, responsive_breakpoint_set, reset) {
3080            var sliderHeight = defaultHeight;
3081            if(!reset) {
3082                if(mkdf.windowWidth > responsive_breakpoint_set[0]) {
3083                    sliderHeight = defaultHeight;
3084                } else if(mkdf.windowWidth > responsive_breakpoint_set[1]) {
3085                    sliderHeight = defaultHeight * 0.75;
3086                } else if(mkdf.windowWidth > responsive_breakpoint_set[2]) {
3087                    sliderHeight = defaultHeight * 0.6;
3088                } else if(mkdf.windowWidth > responsive_breakpoint_set[3]) {
3089                    sliderHeight = defaultHeight * 0.55;
3090                } else if(mkdf.windowWidth <= responsive_breakpoint_set[3]) {
3091                    sliderHeight = defaultHeight * 0.45;
3092                }
3093            }
3094
3095            slider.css({'height': (sliderHeight) + 'px'});
3096            slider.find('.mkdf-slider-preloader').css({'height': (sliderHeight) + 'px'});
3097            slider.find('.mkdf-slider-preloader .mkdf-ajax-loader').css({'display': 'block'});
3098            slider.find('.item').css({'height': (sliderHeight) + 'px'});
3099        }
3100
3101        /**
3102         * Calculate heights for slider holder and slide item, depending on window size, but only if slider is set to be full height
3103         * @param slider, current slider
3104         */
3105        var setSliderFullHeight = function(slider) {
3106            console.log($('.mkdf-top-bar').height());
3107            var mobileHeaderHeight = mkdf.windowWidth <= 1024 ? mkdfGlobalVars.vars.mkdfMobileHeaderHeight + $('.mkdf-top-bar').height() : 0;
3108            slider.css({'height': (mkdf.windowHeight - mobileHeaderHeight) + 'px'});
3109            slider.find('.mkdf-slider-preloader').css({'height': (mkdf.windowHeight - mobileHeaderHeight) + 'px'});
3110            slider.find('.mkd-slider-preloader .mkdf-ajax-loader').css({'display': 'block'});
3111            slider.find('.item').css({'height': (mkdf.windowHeight - mobileHeaderHeight) + 'px'});
3112        }
3113
3114        /**
3115         * Set initial sizes for slider elements and put them in global variables
3116         * @param slideItem, each slide
3117         * @param index, index od slide item
3118         */
3119        var setSizeGlobalVariablesForSlideElements = function(slideItem, index) {
3120            window["slider_graphic_width_" + index] = [];
3121            window["slider_graphic_height_" + index] = [];
3122            window["slider_title_" + index] = [];
3123            window["slider_subtitle_" + index] = [];
3124            window["slider_text_" + index] = [];
3125            window["slider_button1_" + index] = [];
3126            window["slider_button2_" + index] = [];
3127
3128            //graphic size
3129            window["slider_graphic_width_" + index].push(parseFloat(slideItem.find('.mkdf-thumb img').data("width")));
3130            window["slider_graphic_height_" + index].push(parseFloat(slideItem.find('.mkdf-thumb img').data("height")));
3131
3132            // font-size (0)
3133            window["slider_title_" + index].push(parseFloat(slideItem.find('.mkdf-slide-title').css("font-size")));
3134            window["slider_subtitle_" + index].push(parseFloat(slideItem.find('.mkdf-slide-subtitle').css("font-size")));
3135            window["slider_text_" + index].push(parseFloat(slideItem.find('.mkdf-slide-text').css("font-size")));
3136            window["slider_button1_" + index].push(parseFloat(slideItem.find('.mkdf-btn:eq(0)').css("font-size")));
3137            window["slider_button2_" + index].push(parseFloat(slideItem.find('.mkdf-btn:eq(1)').css("font-size")));
3138
3139            // line-height (1)
3140            window["slider_title_" + index].push(parseFloat(slideItem.find('.mkdf-slide-title').css("line-height")));
3141            window["slider_subtitle_" + index].push(parseFloat(slideItem.find('.mkdf-slide-subtitle').css("line-height")));
3142            window["slider_text_" + index].push(parseFloat(slideItem.find('.mkdf-slide-text').css("line-height")));
3143            window["slider_button1_" + index].push(parseFloat(slideItem.find('.mkdf-btn:eq(0)').css("line-height")));
3144            window["slider_button2_" + index].push(parseFloat(slideItem.find('.mkdf-btn:eq(1)').css("line-height")));
3145
3146            // letter-spacing (2)
3147            window["slider_title_" + index].push(parseFloat(slideItem.find('.mkdf-slide-title').css("letter-spacing")));
3148            window["slider_subtitle_" + index].push(parseFloat(slideItem.find('.mkdf-slide-subtitle').css("letter-spacing")));
3149            window["slider_text_" + index].push(parseFloat(slideItem.find('.mkdf-slide-text').css("letter-spacing")));
3150            window["slider_button1_" + index].push(parseFloat(slideItem.find('.mkdf-btn:eq(0)').css("letter-spacing")));
3151            window["slider_button2_" + index].push(parseFloat(slideItem.find('.mkdf-btn:eq(1)').css("letter-spacing")));
3152
3153            // margin-bottom (3)
3154            window["slider_title_" + index].push(parseFloat(slideItem.find('.mkdf-slide-title').css("margin-bottom")));
3155            window["slider_subtitle_" + index].push(parseFloat(slideItem.find('.mkdf-slide-subtitle').css("margin-bottom")));
3156
3157
3158            // slider_button padding top/bottom(3), padding left/right(4)
3159            window["slider_button1_" + index].push(parseFloat(slideItem.find('.mkdf-btn:eq(0)').css("padding-top")));
3160            window["slider_button2_" + index].push(parseFloat(slideItem.find('.mkdf-btn:eq(1)').css("padding-top")));
3161
3162            window["slider_button1_" + index].push(parseFloat(slideItem.find('.mkdf-btn:eq(0)').css("padding-left")));
3163            window["slider_button2_" + index].push(parseFloat(slideItem.find('.mkdf-btn:eq(1)').css("padding-left")));
3164
3165        }
3166
3167        /**
3168         * Set responsive coefficients for slider elements
3169         * @param responsiveBreakpointSet, responsive breakpoints
3170         * @param coefficientsGraphicArray, responsive coeaficcients for graphic
3171         * @param coefficientsTitleArray, responsive coeaficcients for title
3172         * @param coefficientsSubtitleArray, responsive coeaficcients for subtitle
3173         * @param coefficientsTextArray, responsive coeaficcients for text
3174         * @param coefficientsButtonArray, responsive coeaficcients for button
3175         */
3176        var setSliderElementsResponsiveCoeffeicients = function(responsiveBreakpointSet,coefficientsGraphicArray,coefficientsTitleArray,coefficientsSubtitleArray,coefficientsTextArray,coefficientsButtonArray) {
3177
3178            function coefficientsSetter(graphicArray,titleArray,subtitleArray,textArray,buttonArray){
3179                sliderGraphicCoefficient = graphicArray;
3180                sliderTitleCoefficient = titleArray;
3181                sliderSubtitleCoefficient = subtitleArray;
3182                sliderTextCoefficient = textArray;
3183                sliderButtonCoefficient = buttonArray;
3184            }
3185
3186            if(mkdf.windowWidth > responsiveBreakpointSet[0]) {
3187                coefficientsSetter(coefficientsGraphicArray[0],coefficientsTitleArray[0],coefficientsSubtitleArray[0],coefficientsTextArray[0],coefficientsButtonArray[0]);
3188            }else if(mkdf.windowWidth > responsiveBreakpointSet[1]){
3189                coefficientsSetter(coefficientsGraphicArray[1],coefficientsTitleArray[1],coefficientsSubtitleArray[1],coefficientsTextArray[1],coefficientsButtonArray[1]);
3190            }else if(mkdf.windowWidth > responsiveBreakpointSet[2]){
3191                coefficientsSetter(coefficientsGraphicArray[2],coefficientsTitleArray[2],coefficientsSubtitleArray[2],coefficientsTextArray[2],coefficientsButtonArray[2]);
3192            }else if(mkdf.windowWidth > responsiveBreakpointSet[3]){
3193                coefficientsSetter(coefficientsGraphicArray[3],coefficientsTitleArray[3],coefficientsSubtitleArray[3],coefficientsTextArray[3],coefficientsButtonArray[3]);
3194            }else if (mkdf.windowWidth > responsiveBreakpointSet[4]) {
3195                coefficientsSetter(coefficientsGraphicArray[4],coefficientsTitleArray[4],coefficientsSubtitleArray[4],coefficientsTextArray[4],coefficientsButtonArray[4]);
3196            }else if (mkdf.windowWidth > responsiveBreakpointSet[5]){
3197                coefficientsSetter(coefficientsGraphicArray[5],coefficientsTitleArray[5],coefficientsSubtitleArray[5],coefficientsTextArray[5],coefficientsButtonArray[5]);
3198            }else{
3199                coefficientsSetter(coefficientsGraphicArray[6],coefficientsTitleArray[6],coefficientsSubtitleArray[6],coefficientsTextArray[6],coefficientsButtonArray[6]);
3200            }
3201
3202            // letter-spacing decrease quicker
3203            sliderTitleCoefficientLetterSpacing = sliderTitleCoefficient;
3204            sliderSubtitleCoefficientLetterSpacing = sliderSubtitleCoefficient;
3205            sliderTextCoefficientLetterSpacing = sliderTextCoefficient;
3206            if(mkdf.windowWidth <= responsiveBreakpointSet[0]) {
3207                sliderTitleCoefficientLetterSpacing = sliderTitleCoefficient/2;
3208                sliderSubtitleCoefficientLetterSpacing = sliderSubtitleCoefficient/2;
3209                sliderTextCoefficientLetterSpacing = sliderTextCoefficient/2;
3210            }
3211        }
3212
3213        /**
3214         * Set sizes for slider elements
3215         * @param slideItem, each slide
3216         * @param index, index od slide item
3217         * @param reset, boolean for reseting sizes
3218         */
3219        var setSliderElementsSize = function(slideItem, index, reset) {
3220
3221            if(reset) {
3222                sliderGraphicCoefficient = sliderTitleCoefficient = sliderSubtitleCoefficient = sliderTextCoefficient = sliderButtonCoefficient = sliderTitleCoefficientLetterSpacing = sliderSubtitleCoefficientLetterSpacing = sliderTextCoefficientLetterSpacing = 1;
3223            }
3224
3225            slideItem.find('.mkdf-thumb').css({
3226                "width": Math.round(window["slider_graphic_width_" + index][0]*sliderGraphicCoefficient) + 'px',
3227                "height": Math.round(window["slider_graphic_height_" + index][0]*sliderGraphicCoefficient) + 'px'
3228            });
3229
3230            slideItem.find('.mkdf-slide-title').css({
3231                "font-size": Math.round(window["slider_title_" + index][0]*sliderTitleCoefficient) + 'px',
3232                "line-height": Math.round(window["slider_title_" + index][1]*sliderTitleCoefficient) + 'px',
3233                "letter-spacing": Math.round(window["slider_title_" + index][2]*sliderTitleCoefficient) + 'px',
3234                "margin-bottom": Math.round(window["slider_title_" + index][3]*sliderTitleCoefficient) + 'px'
3235            });
3236
3237            slideItem.find('.mkdf-slide-subtitle').css({
3238                "font-size": Math.round(window["slider_subtitle_" + index][0]*sliderSubtitleCoefficient) + 'px',
3239                "line-height": Math.round(window["slider_subtitle_" + index][1]*sliderSubtitleCoefficient) + 'px',
3240                "margin-bottom": Math.round(window["slider_subtitle_" + index][3]*sliderSubtitleCoefficient) + 'px',
3241                "letter-spacing": Math.round(window["slider_subtitle_" + index][2]*sliderSubtitleCoefficientLetterSpacing) + 'px'
3242            });
3243
3244            slideItem.find('.mkdf-slide-text').css({
3245                "font-size": Math.round(window["slider_text_" + index][0]*sliderTextCoefficient) + 'px',
3246                "line-height": Math.round(window["slider_text_" + index][1]*sliderTextCoefficient) + 'px',
3247                "letter-spacing": Math.round(window["slider_text_" + index][2]*sliderTextCoefficientLetterSpacing) + 'px'
3248            });
3249
3250            slideItem.find('.mkdf-btn:eq(0)').css({
3251                "font-size": Math.round(window["slider_button1_" + index][0]*sliderButtonCoefficient) + 'px',
3252                "line-height": Math.round(window["slider_button1_" + index][1]*sliderButtonCoefficient) + 'px',
3253                "letter-spacing": Math.round(window["slider_button1_" + index][2]*sliderButtonCoefficient) + 'px',
3254                "padding-top": Math.round(window["slider_button1_" + index][3]*sliderButtonCoefficient) + 'px',
3255                "padding-bottom": Math.round(window["slider_button1_" + index][3]*sliderButtonCoefficient) + 'px',
3256                "padding-left": Math.round(window["slider_button1_" + index][4]*sliderButtonCoefficient) + 'px',
3257                "padding-right": Math.round(window["slider_button1_" + index][4]*sliderButtonCoefficient) + 'px'
3258            });
3259            slideItem.find('.mkdf-btn:eq(1)').css({
3260                "font-size": Math.round(window["slider_button2_" + index][0]*sliderButtonCoefficient) + 'px',
3261                "line-height": Math.round(window["slider_button2_" + index][1]*sliderButtonCoefficient) + 'px',
3262                "letter-spacing": Math.round(window["slider_button2_" + index][2]*sliderButtonCoefficient) + 'px',
3263                "padding-top": Math.round(window["slider_button2_" + index][3]*sliderButtonCoefficient) + 'px',
3264                "padding-bottom": Math.round(window["slider_button2_" + index][3]*sliderButtonCoefficient) + 'px',
3265                "padding-left": Math.round(window["slider_button2_" + index][4]*sliderButtonCoefficient) + 'px',
3266                "padding-right": Math.round(window["slider_button2_" + index][4]*sliderButtonCoefficient) + 'px'
3267            });
3268
3269        }
3270
3271        /**
3272         * Set heights for slider and elemnts depending on slider settings (full height, responsive height od set height)
3273         * @param slider, current slider
3274         */
3275        var setHeights =  function(slider) {
3276
3277            slider.find('.item').each(function (i) {
3278                setSizeGlobalVariablesForSlideElements($(this),i);
3279                setSliderElementsSize($(this), i, false);
3280            });
3281
3282            if(slider.hasClass('mkdf-full-screen')){
3283
3284                setSliderFullHeight(slider);
3285
3286                $(window).resize(function() {
3287                    setSliderElementsResponsiveCoeffeicients(responsiveBreakpointSet,coefficientsGraphicArray,coefficientsTitleArray,coefficientsSubtitleArray,coefficientsTextArray,coefficientsButtonArray);
3288                    setSliderFullHeight(slider);
3289                    slider.find('.item').each(function(i){
3290                        setSliderElementsSize($(this), i, false);
3291                    });
3292                });
3293
3294            }else if(slider.hasClass('mkdf-responsive-height')){
3295
3296                var defaultHeight = slider.data('height');
3297                setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, false);
3298
3299                $(window).resize(function() {
3300                    setSliderElementsResponsiveCoeffeicients(responsiveBreakpointSet,coefficientsGraphicArray,coefficientsTitleArray,coefficientsSubtitleArray,coefficientsTextArray,coefficientsButtonArray);
3301                    setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, false);
3302                    slider.find('.item').each(function(i){
3303                        setSliderElementsSize($(this), i, false);
3304                    });
3305                });
3306
3307            }else {
3308                var defaultHeight = slider.data('height');
3309
3310                slider.find('.mkdf-slider-preloader').css({'height': (slider.height()) + 'px'});
3311                slider.find('.mkdf-slider-preloader .mkdf-ajax-loader').css({'display': 'block'});
3312
3313                mkdf.windowWidth < 1000 ? setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, false) : setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, true);
3314
3315                $(window).resize(function() {
3316                    setSliderElementsResponsiveCoeffeicients(responsiveBreakpointSet,coefficientsGraphicArray,coefficientsTitleArray,coefficientsSubtitleArray,coefficientsTextArray,coefficientsButtonArray);
3317                    if(mkdf.windowWidth < 1000){
3318                        setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, false);
3319                        slider.find('.item').each(function(i){
3320                            setSliderElementsSize($(this),i,false);
3321                        });
3322                    }else{
3323                        setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, true);
3324                        slider.find('.item').each(function(i){
3325                            setSliderElementsSize($(this),i,true);
3326                        });
3327                    }
3328                });
3329            }
3330        }
3331
3332        /**
3333         * Set prev/next numbers on navigation arrows
3334         * @param slider, current slider
3335         * @param currentItem, current slide item index
3336         * @param totalItemCount, total number of slide items
3337         */
3338        var setPrevNextNumbers = function(slider, currentItem, totalItemCount) {
3339            if(currentItem == 1){
3340                slider.find('.left.carousel-control .prev').html(totalItemCount);
3341                slider.find('.right.carousel-control .next').html(currentItem + 1);
3342            }else if(currentItem == totalItemCount){
3343                slider.find('.left.carousel-control .prev').html(currentItem - 1);
3344                slider.find('.right.carousel-control .next').html(1);
3345            }else{
3346                slider.find('.left.carousel-control .prev').html(currentItem - 1);
3347                slider.find('.right.carousel-control .next').html(currentItem + 1);
3348            }
3349        }
3350
3351        /**
3352         * Set video background size
3353         * @param slider, current slider
3354         */
3355        var initVideoBackgroundSize = function(slider){
3356            var min_w = 1500; // minimum video width allowed
3357            var video_width_original = 1920;  // original video dimensions
3358            var video_height_original = 1080;
3359            var vid_ratio = 1920/1080;
3360
3361            slider.find('.item .mkdf-video .mkdf-video-wrap').each(function(){
3362
3363                var slideWidth = mkdf.windowWidth;
3364                var slideHeight = $(this).closest('.carousel').height();
3365
3366                $(this).width(slideWidth);
3367
3368                min_w = vid_ratio * (slideHeight+20);
3369                $(this).height(slideHeight);
3370
3371                var scale_h = slideWidth / video_width_original;
3372                var scale_v = (slideHeight - mkdfGlobalVars.vars.mkdfMenuAreaHeight) / video_height_original;
3373                var scale =  scale_v;
3374                if (scale_h > scale_v)
3375                    scale =  scale_h;
3376                if (scale * video_width_original < min_w) {scale = min_
3376w / video_width_original;}
3377
3378                $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * video_width_original +2));
3379                $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * video_height_original +2));
3380                $(this).scrollLeft(($(this).find('video').width() - slideWidth) / 2);
3381                $(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - slideHeight) / 2);
3382                $(this).scrollTop(($(this).find('video').height() - slideHeight) / 2);
3383            });
3384        }
3385
3386        /**
3387         * Init video background
3388         * @param slider, current slider
3389         */
3390        var initVideoBackground = function(slider) {
3391            $('.item mkdf-video-wrap .video').mediaelementplayer({
3392                enableKeyboard: false,
3393                iPadUseNativeControls: false,
3394                pauseOtherPlayers: false,
3395                // force iPhone's native controls
3396                iPhoneUseNativeControls: false,
3397                // force Android's native controls
3398                AndroidUseNativeControls: false
3399            });
3400
3401            $(window).resize(function() {
3402                initVideoBackgroundSize(slider);
3403            });
3404
3405            //mobile check
3406            if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
3407                $('.mkdf-slider .mkdf-mobile-video-image').show();
3408                $('.mkdf-slider .mkdf-video-wrap').remove();
3409            }
3410        }
3411
3412        /**
3413         * initiate slider
3414         * @param slider, current slider
3415         * @param currentItem, current slide item index
3416         * @param totalItemCount, total number of slide items
3417         * @param slideAnimationTimeout, timeout for slide change
3418         */
3419        var initiateSlider = function(slider, totalItemCount, slideAnimationTimeout) {
3420
3421            //set active class on first item
3422            slider.find('.carousel-inner .item:first-child').addClass('active');
3423            //check for header style
3424            mkdfCheckSliderForHeaderStyle($('.carousel .active'), slider.hasClass('mkdf-header-effect'));
3425            // setting numbers on carousel controls
3426            if(slider.hasClass('mkdf-slider-numbers')) {
3427                setPrevNextNumbers(slider, 1, totalItemCount);
3428            }
3429            // set video background if there is video slide
3430            if(slider.find('.item video').length){
3431                initVideoBackgroundSize(slider);
3432                initVideoBackground(slider);
3433            }
3434
3435            //init slider
3436            if(slider.hasClass('mkdf-auto-start')){
3437                slider.carousel({
3438                    interval: slideAnimationTimeout,
3439                    pause: false
3440                });
3441
3442                //pause slider when hover slider button
3443                slider.find('.slide_buttons_holder .qbutton')
3444                    .mouseenter(function() {
3445                        slider.carousel('pause');
3446                    })
3447                    .mouseleave(function() {
3448                        slider.carousel('cycle');
3449                    });
3450            } else {
3451                slider.carousel({
3452                    interval: 0,
3453                    pause: false
3454                });
3455            }
3456
3457
3458            //initiate image animation
3459            if($('.carousel-inner .item:first-child').hasClass('mkdf-animate-image') && mkdf.windowWidth > 1000){
3460                slider.find('.carousel-inner .item.mkdf-animate-image:first-child .mkdf-image').transformAnimate({
3461                    transform: "matrix("+matrixArray[$('.carousel-inner .item:first-child').data('mkdf_animate_image')]+")",
3462                    duration: 30000
3463                });
3464            }
3465
3466        }
3467
3468        return {
3469            init: function() {
3470                if(sliders.length) {
3471                    sliders.each(function() {
3472                        var $this = $(this);
3473                        var slideAnimationTimeout = $this.data('slide_animation_timeout');
3474                        var totalItemCount = $this.find('.item').length;
3475                        if($this.data('mkdf_responsive_breakpoints')){
3476                            if($this.data('mkdf_responsive_breakpoints') == 'set2'){
3477                                responsiveBreakpointSet = [1600,1300,1000,768,567,320];
3478                            }
3479                        }
3480                        coefficientsGraphicArray = $this.data('mkdf_responsive_graphic_coefficients').split(',');
3481                        coefficientsTitleArray = $this.data('mkdf_responsive_title_coefficients').split(',');
3482                        coefficientsSubtitleArray = $this.data('mkdf_responsive_subtitle_coefficients').split(',');
3483                        coefficientsTextArray = $this.data('mkdf_responsive_text_coefficients').split(',');
3484                        coefficientsButtonArray = $this.data('mkdf_responsive_button_coefficients').split(',');
3485
3486                        setSliderElementsResponsiveCoeffeicients(responsiveBreakpointSet,coefficientsGraphicArray,coefficientsTitleArray,coefficientsSubtitleArray,coefficientsTextArray,coefficientsButtonArray);
3487
3488                        setHeights($this);
3489                        /*** wait until first video or image is loaded and than initiate slider - start ***/
3490
3491                        if(mkdf.htmlEl.hasClass('touch')){
3492                            if($this.find('.item:first-child .mkdf-mobile-video-image').length > 0){
3493                                var src = imageRegex.exec($this.find('.item:first-child .mkdf-mobile-video-image').attr('style'));
3494                            }else{
3495                                var src = imageRegex.exec($this.find('.item:first-child .mkdf-image').attr('style'));
3496                            }
3497                            if(src) {
3498                                var backImg = new Image();
3499                                backImg.src = src[1];
3500                                $(backImg).load(function(){
3501                                    $('.mkdf-slider-preloader').fadeOut(500);
3502                                    initiateSlider($this,totalItemCount,slideAnimationTimeout);
3503                                });
3504                            }
3505                        } else {
3506                            if($this.find('.item:first-child video').length > 0){
3507                                $this.find('.item:first-child video').get(0).addEventListener('loadeddata',function(){
3508                                    $('.mkdf-slider-preloader').fadeOut(500);
3509                                    initiateSlider($this,totalItemCount,slideAnimationTimeout);
3510                                });
3511                            }else{
3512                                var src = imageRegex.exec($this.find('.item:first-child .mkdf-image').attr('style'));
3513                                if (src) {
3514                                    var backImg = new Image();
3515                                    backImg.src = src[1];
3516                                    $(backImg).load(function(){
3517                                        $('.mkdf-slider-preloader').fadeOut(500);
3518                                        initiateSlider($this,totalItemCount,slideAnimationTimeout);
3519                                    });
3520                                }
3521                            }
3522                        }
3523                        /*** wait until first video or image is loaded and than initiate slider - end ***/
3524
3525                        $this.on('slide.bs.carousel', function () {
3526                            $this.addClass('mkdf-in-progress');
3527                            $this.find('.active .mkdf-slider-content-outer').fadeTo(250,0);
3528                        });
3529                        $this.on('slid.bs.carousel', function () {
3530                            $this.removeClass('mkdf-in-progress');
3531                            $this.find('.active .mkdf-slider-content-outer').fadeTo(0,1);
3532
3533                            // setting numbers on carousel controls
3534                            if($this.hasClass('mkdf-slider-numbers')) {
3535                                var currentItem = $('.item').index($('.item.active')[0]) + 1;
3536                                setPrevNextNumbers($this, currentItem, totalItemCount);
3537                            }
3538
3539                            // initiate image animation on active slide and reset all others
3540                            $('.item.mkdf-animate-image .mkdf-image').stop().css({'transform':'', '-webkit-transform':''});
3541                            if($('.item.active').hasClass('mkdf-animate-image') && mkdf.windowWidth > 1000){
3542                                $('.item.mkdf-animate-image.active .mkdf-image').transformAnimate({
3543                                    transform: "matrix("+matrixArray[$('.item.mkdf-animate-image.active').data('mkdf_animate_image')]+")",
3544                                    duration: 30000
3545                                });
3546                            }
3547
3548                        });
3549
3550                        /* swipe functionality - start */
3551                        $this.swipe( {
3552                            swipeLeft: function(){ $this.carousel('next'); },
3553                            swipeRight: function(){ $this.carousel('prev'); },
3554                            threshold:20
3555                        });
3556                        /* swipe functionality - end */
3557
3558                    });
3559                }
3560
3561                if($('.no-touch .carousel').length){
3562                    var skrollr_slider = skrollr.init({
3563                        smoothScrolling: false,
3564                        forceHeight: false
3565                    });
3566                    skrollr_slider.refresh();
3567                }
3568            }
3569        };
3570    };
3571
3572    /**
3573     * Check if slide effect on header style changing
3574     * @param slide, current slide
3575     * @param headerEffect, flag if slide
3576     */
3577
3578    function mkdfCheckSliderForHeaderStyle(slide, headerEffect) {
3579
3580        if($('.mkdf-slider .carousel').length > 0) {
3581
3582            var slideHeaderStyle = "";
3583            if (slide.hasClass('light')) { slideHeaderStyle = 'mkdf-light-header'; }
3584            if (slide.hasClass('dark')) { slideHeaderStyle = 'mkdf-dark-header'; }
3585
3586            if (slideHeaderStyle !== "") {
3587                if (headerEffect) {
3588                    mkdf.body.removeClass('mkdf-dark-header mkdf-light-header').addClass(slideHeaderStyle);
3589                }
3590            } else {
3591                if (headerEffect) {
3592                    mkdf.body.removeClass('mkdf-dark-header mkdf-light-header').addClass(mkdf.defaultHeaderStyle);
3593                }
3594
3595            }
3596        }
3597    }
3598
3599    var mkdfTabbedGallery = function() {
3600        var tabbedGalleries = $('.mkdf-tabbed-gallery');
3601		var thisTabbedGallery;
3602		var gallery;
3603		var tabContainers;
3604
3605        var initTabs = function(tabbedGallery) {
3606            tabbedGallery.tabs({
3607				show: 500
3608			});
3609        };
3610
3611        var initGallery = function(gallery) {
3612			gallery.owlCarousel();
3613        };
3614
3615        var initTabsIcon = function(tabContent) {
3616			if(tabContent.length) {
3617				tabContent.each(function() {
3618					var thisTabContent = $(this);
3619					var id = thisTabContent.attr('id');
3620					var icon = '';
3621
3622					if(typeof thisTabContent.data('icon-html') !== 'undefined' || thisTabContent.data('icon-html') !== 'false') {
3623						icon = thisTabContent.data('icon-html');
3624					}
3625
3626					var tabNav = thisTabbedGallery.find('.mkdf-tg-nav > li > a[href="#'+id+'"]').get(0);
3627					if(tabNav) {
3628						tabNav.innerHTML = icon + tabNav.innerHTML;
3629					}
3630				});
3631			}
3632        };
3633
3634        return {
3635            init: function() {
3636                if(tabbedGalleries.length) {
3637                    tabbedGalleries.each(function() {
3638						thisTabbedGallery = $(this);
3639
3640						gallery = thisTabbedGallery.find('.mkdf-tg-gallery');
3641                        initGallery(gallery);
3642
3643                        initTabs(thisTabbedGallery);
3644
3645						tabContainers = thisTabbedGallery.find('.mkdf-tg-tab-container');
3646						initTabsIcon(tabContainers);
3647                    });
3648                }
3649            }
3650        }
3651    };
3652
3653})(jQuery);
3654(function($) {
3655    'use strict';
3656
3657    $(document).ready(function () {
3658        mkdfInitQuantityButtons();
3659        mkdfInitSelect2();
3660        mkdfMiniCartButtons();
3661        mkdfpriceSlideButton();
3662        mkdfInitSingleProductLightbox();
3663    });
3664
3665    function mkdfInitQuantityButtons() {
3666
3667        $(document).on( 'click', '.mkdf-quantity-minus, .mkdf-quantity-plus', function(e) {    
3668            e.stopPropagation();
3669
3670            var button = $(this),
3671                inputField = button.siblings('.mkdf-quantity-input'),
3672                step = parseFloat(inputField.attr('step')),
3673                max = parseFloat(inputField.attr('max')),
3674                minus = false,
3675                inputValue = parseFloat(inputField.val()),
3676                newInputValue;
3677
3678            if (button.hasClass('mkdf-quantity-minus')) {
3679                minus = true;
3680            }
3681
3682            if (minus) {
3683                newInputValue = inputValue - step;
3684                if (newInputValue >= 1) {
3685                    inputField.val(newInputValue);
3686                } else {
3687                    inputField.val(1);
3688                }
3689            } else {
3690                newInputValue = inputValue + step;
3691                if ( max === undefined ) {
3692                    inputField.val(newInputValue);
3693                } else {
3694                    if ( newInputValue >= max ) {
3695                        inputField.val(max);
3696                    } else {
3697                        inputField.val(newInputValue);
3698                    }
3699                }
3700            }
3701
3702            inputField.trigger( 'change' );
3703        });
3704    }
3705
3706    function mkdfInitSelect2() {
3707
3708        if ($('.woocommerce-ordering .orderby').length ||  $('#calc_shipping_country').length ) {
3709
3710            $('.woocommerce-ordering .orderby').select2({
3711                minimumResultsForSearch: Infinity
3712            });
3713
3714            $('#calc_shipping_country').select2();
3715        }
3716    }
3717
3718    function mkdfMiniCartButtons() {
3719        var buttons = $('.widget_shopping_cart .buttons a');
3720
3721        if(buttons.length) {
3722            buttons.addClass('mkdf-btn mkdf-btn-small mkdf-btn-white');
3723        }
3724    }
3725
3726    function mkdfpriceSlideButton() {
3727        var button = $('.price_slider_amount .button');
3728
3729        if(button.length) {
3730            button.addClass('mkdf-btn mkdf-btn-medium mkdf-btn-solid');
3731        }
3732    }
3733
3734    /*
3735     ** Init Product Single Pretty Photo attributes
3736     */
3737    function mkdfInitSingleProductLightbox() {
3738        var item = $('.mkdf-woocommerce-single-page .images .woocommerce-product-gallery__image');
3739
3740        if(item.length) {
3741            item.children('a').attr('data-rel', 'prettyPhoto[product-gallery]');
3742
3743            if (typeof mkdf.modules.common.mkdfPrettyPhoto === "function") {
3744                mkdf.modules.common.mkdfPrettyPhoto();
3745            }
3746        }
3747    }
3748
3749
3750})(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.