?? GreyFile — Mystic File Browser

Current path: home/webdevt/www/wdp/wp-content/themes/quadric/assets/js/



?? Go up: /home/webdevt/www/wdp/wp-content/themes/quadric/assets

?? Viewing: modules.js

(function($) {
    "use strict";

    window.edgtf = {};
    edgtf.modules = {};

    edgtf.scroll = 0;
    edgtf.window = $(window);
    edgtf.document = $(document);
    edgtf.windowWidth = $(window).width();
    edgtf.windowHeight = $(window).height();
    edgtf.body = $('body');
    edgtf.html = $('html, body');
    edgtf.htmlEl = $('html');
    edgtf.menuDropdownHeightSet = false;
    edgtf.defaultHeaderStyle = '';
    edgtf.minVideoWidth = 1500;
    edgtf.videoWidthOriginal = 1280;
    edgtf.videoHeightOriginal = 720;
    edgtf.videoRatio = 1280/720;

    //set boxed layout width variable for various calculations

    switch(true){
        case edgtf.body.hasClass('edgtf-grid-1300'):
            edgtf.boxedLayoutWidth = 1350;
            break;
        case edgtf.body.hasClass('edgtf-grid-1200'):
            edgtf.boxedLayoutWidth = 1250;
            break;
        case edgtf.body.hasClass('edgtf-grid-1000'):
            edgtf.boxedLayoutWidth = 1050;
            break;
        case edgtf.body.hasClass('edgtf-grid-800'):
            edgtf.boxedLayoutWidth = 850;
            break;
        default :
            edgtf.boxedLayoutWidth = 1150;
            break;
    }
    
    $(document).ready(function(){
        edgtf.scroll = $(window).scrollTop();

        //set global variable for header style which we will use in various functions
        if(edgtf.body.hasClass('edgtf-dark-header')){ edgtf.defaultHeaderStyle = 'edgtf-dark-header';}
        if(edgtf.body.hasClass('edgtf-light-header')){ edgtf.defaultHeaderStyle = 'edgtf-light-header';}

    });


    $(window).resize(function() {
        edgtf.windowWidth = $(window).width();
        edgtf.windowHeight = $(window).height();
    });


    $(window).scroll(function(){
        edgtf.scroll = $(window).scrollTop();
    });



})(jQuery);
(function($) {
	"use strict";

    var common = {};
    edgtf.modules.common = common;

    common.edgtfFluidVideo = edgtfFluidVideo;
    common.edgtfPreloadBackgrounds = edgtfPreloadBackgrounds;
    common.edgtfSetFloatingBackground = edgtfSetFloatingBackground;
    common.edgtfPrettyPhoto = edgtfPrettyPhoto;
    common.edgtfCheckHeaderStyleOnScroll = edgtfCheckHeaderStyleOnScroll;
    common.edgtfInitParallax = edgtfInitParallax;
    //common.edgtfSmoothScroll = edgtfSmoothScroll;
    common.edgtfEnableScroll = edgtfEnableScroll;
    common.edgtfDisableScroll = edgtfDisableScroll;
    common.edgtfWheel = edgtfWheel;
    common.edgtfKeydown = edgtfKeydown;
    common.edgtfPreventDefaultValue = edgtfPreventDefaultValue;
    common.edgtfOwlSlider = edgtfOwlSlider;
    common.edgtfInitSelfHostedVideoPlayer = edgtfInitSelfHostedVideoPlayer;
    common.edgtfSelfHostedVideoSize = edgtfSelfHostedVideoSize;
    common.edgtfInitBackToTop = edgtfInitBackToTop;
    common.edgtfBackButtonShowHide = edgtfBackButtonShowHide;
    common.edgtfCheckSVG = edgtfCheckSVG;
	common.edgtfSmoothTransition = edgtfSmoothTransition;


	$(document).ready(function() {
		edgtfFluidVideo();
        edgtfPreloadBackgrounds();
        edgtfPrettyPhoto();
        edgtfInitElementsAnimations();
        edgtfInitAnchor().init();
        edgtfInitVideoBackground();
        edgtfInitVideoBackgroundSize();
		edgtfSetFloatingBackground();
        edgtfSetContentBottomMargin();
		edgtfFooterHeight();
        //edgtfSmoothScroll();
        edgtfOwlSlider();
        edgtfInitSelfHostedVideoPlayer();
		edgtfSelfHostedVideoSize();
        edgtfInitBackToTop();
        edgtfBackButtonShowHide();
	});

    $(window).on('load', function() {
        edgtfCheckHeaderStyleOnScroll(); //called on load since all content needs to be loaded in order to calculate row's position right
        edgtfInitParallax();
		edgtfSmoothTransition();
    });

	$(window).resize(function() {
		edgtfInitVideoBackgroundSize();
		edgtfSelfHostedVideoSize();
		edgtfFooterHeight();
	});

	function edgtfFluidVideo() {
        fluidvids.init({
			selector: ['iframe'],
			players: ['www.youtube.com', 'player.vimeo.com']
		});
	}

    /**
     * Init Owl Carousel
     */
    function edgtfOwlSlider() {

        var sliders = $('.edgtf-owl-slider');

        if (sliders.length) {
            sliders.each(function(){

                var slider = $(this);
                slider.waitForImages(function(){
                    slider.owlCarousel({
                        items: 1,
                        loop:true,
                        animateIn:'scaleUpIn',
                        animateOut:'scaleUpOut',
                        nav: true,
                        autoHeight: true,
                        dots: false,
                        navText: [
                            '<span class="edgtf-prev-icon"><i class="icon-arrows-left"></i></span>',
                            '<span class="edgtf-next-icon"><i class="icon-arrows-right"></i></span>'
                        ]
                    });
                });
            });
        }

    }


    /*
     *	Preload background images for elements that have 'edgtf-preload-background' class
     */
    function edgtfPreloadBackgrounds(){

        $(".edgtf-preload-background").each(function() {
            var preloadBackground = $(this);
            if(preloadBackground.css("background-image") !== "" && preloadBackground.css("background-image") != "none") {

                var bgUrl = preloadBackground.attr('style');

                bgUrl = bgUrl.match(/url\(["']?([^'")]+)['"]?\)/);
                bgUrl = bgUrl ? bgUrl[1] : "";

                if (bgUrl) {
                    var backImg = new Image();
                    backImg.src = bgUrl;
                    $(backImg).on('load', function(){
                        preloadBackground.removeClass('edgtf-preload-background');
                    });
                }
            }else{
                $(window).on('load', function(){ preloadBackground.removeClass('edgtf-preload-background'); }); //make sure that edgtf-preload-background class is removed from elements with forced background none in css
            }
        });
    }

    function edgtfPrettyPhoto() {
        var markupWhole = '<div class="pp_pic_holder"> \
                        <div class="ppt">&nbsp;</div> \
                        <div class="pp_top"> \
                            <div class="pp_left"></div> \
                            <div class="pp_middle"></div> \
                            <div class="pp_right"></div> \
                        </div> \
                        <div class="pp_content_container"> \
                            <div class="pp_left"> \
                            <div class="pp_right"> \
                                <div class="pp_content"> \
                                    <div class="pp_loaderIcon"></div> \
                                    <div class="pp_fade"> \
                                        <a href="#" class="pp_expand" title="Expand the image">Expand</a> \
                                        <div class="pp_hoverContainer"> \
                                            <a class="pp_next" href="#"><span class="icon-arrows-right"></span></a> \
                                            <a class="pp_previous" href="#"><span class="icon-arrows-left"></span></a> \
                                        </div> \
                                        <div id="pp_full_res"></div> \
                                        <div class="pp_details"> \
                                            <div class="pp_nav"> \
                                                <a href="#" class="pp_arrow_previous">Previous</a> \
                                                <p class="currentTextHolder">0/0</p> \
                                                <a href="#" class="pp_arrow_next">Next</a> \
                                            </div> \
                                            <p class="pp_description"></p> \
                                            {pp_social} \
                                            <a class="pp_close" href="#">Close</a> \
                                        </div> \
                                    </div> \
                                </div> \
                            </div> \
                            </div> \
                        </div> \
                        <div class="pp_bottom"> \
                            <div class="pp_left"></div> \
                            <div class="pp_middle"></div> \
                            <div class="pp_right"></div> \
                        </div> \
                    </div> \
                    <div class="pp_overlay"></div>';

        $("a[data-rel^='prettyPhoto']").prettyPhoto({
            hook: 'data-rel',
            animation_speed: 'normal', /* fast/slow/normal */
            slideshow: false, /* false OR interval time in ms */
            autoplay_slideshow: false, /* true/false */
            opacity: 0.80, /* Value between 0 and 1 */
            show_title: true, /* true/false */
            allow_resize: true, /* Resize the photos bigger than viewport. true/false */
            horizontal_padding: 0,
            default_width: 960,
            default_height: 540,
            counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
            theme: 'pp_default', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
            hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
            wmode: 'opaque', /* Set the flash wmode attribute */
            autoplay: true, /* Automatically start videos: True/False */
            modal: false, /* If set to true, only the close button will close the window */
            overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
            keyboard_shortcuts: true, /* Set to false if you open forms inside prettyPhoto */
            deeplinking: false,
            custom_markup: '',
            social_tools: false,
            markup: markupWhole
        });
    }

    /*
     *	Check header style on scroll, depending on row settings
     */
    function edgtfCheckHeaderStyleOnScroll(){

        if($('[data-edgtf_header_style]').length > 0 && edgtf.body.hasClass('edgtf-header-style-on-scroll')) {

            var waypointSelectors = $('.edgtf-full-width-inner > .wpb_row.edgtf-section, .edgtf-full-width-inner > .edgtf-parallax-section-holder, .edgtf-container-inner > .wpb_row.edgtf-section, .edgtf-container-inner > .edgtf-parallax-section-holder, .edgtf-portfolio-single > .wpb_row.edgtf-section');
            var changeStyle = function(element){
                (element.data("edgtf_header_style") !== undefined) ? edgtf.body.removeClass('edgtf-dark-header edgtf-light-header').addClass(element.data("edgtf_header_style")) : edgtf.body.removeClass('edgtf-dark-header edgtf-light-header').addClass(''+edgtf.defaultHeaderStyle);
            };

            waypointSelectors.waypoint( function(direction) {
                if(direction === 'down') { changeStyle($(this.element)); }
            }, { offset: 0});

            waypointSelectors.waypoint( function(direction) {
                if(direction === 'up') { changeStyle($(this.element)); }
            }, { offset: function(){
                return -$(this.element).outerHeight();
            } });
        }
    }

    /*
     *	Start animations on elements
     */
    function edgtfInitElementsAnimations(){

        var touchClass = $('.edgtf-no-animations-on-touch'),
            noAnimationsOnTouch = true,
            elements = $('.edgtf-grow-in, .edgtf-fade-in-down, .edgtf-element-from-fade, .edgtf-element-from-left, .edgtf-element-from-right, .edgtf-element-from-top, .edgtf-element-from-bottom, .edgtf-flip-in, .edgtf-x-rotate, .edgtf-z-rotate, .edgtf-y-translate, .edgtf-fade-in, .edgtf-fade-in-left-x-rotate'),
            clasess,
            animationClass;

        if (touchClass.length) {
            noAnimationsOnTouch = false;
        }

        if(elements.length > 0 && noAnimationsOnTouch){
            elements.each(function(){
				$(this).appear(function() {
					clasess = $(this).attr('class').split(/\s+/);
					animationClass = clasess[1];

					$(this).addClass(animationClass+'-on');
				},{accX: 0, accY: edgtfQuadricGlobalVars.vars.edgtfElementAppearAmount});
            });
        }

    }


/*
 **	Sections with parallax background image
 */
function edgtfInitParallax(){

    if($('.edgtf-parallax-section-holder').length){
        $('.edgtf-parallax-section-holder').each(function() {

            var parallaxElement = $(this);
            if(parallaxElement.hasClass('edgtf-full-screen-height-parallax')){
                parallaxElement.height(edgtf.windowHeight);
                parallaxElement.find('.edgtf-parallax-content-outer').css('padding',0);
            }
            var speed = parallaxElement.data('edgtf-parallax-speed')*0.4;
            parallaxElement.parallax("50%", speed);
        });
    }
}

/*
 **	Anchor functionality
 */
var edgtfInitAnchor = edgtf.modules.common.edgtfInitAnchor = function() {

    /**
     * Set active state on clicked anchor
     * @param anchor, clicked anchor
     */
    var setActiveState = function(anchor){

        $('.edgtf-main-menu .edgtf-active-item, .edgtf-mobile-nav .edgtf-active-item, .edgtf-vertical-menu .edgtf-active-item, .edgtf-fullscreen-menu .edgtf-active-item').removeClass('edgtf-active-item');
        anchor.parent().addClass('edgtf-active-item');

        $('.edgtf-main-menu a, .edgtf-mobile-nav a, .edgtf-vertical-menu a, .edgtf-fullscreen-menu a').removeClass('current');
        anchor.addClass('current');
    };

    /**
     * Check anchor active state on scroll
     */
    var checkActiveStateOnScroll = function(){

        $('[data-edgtf-anchor]').waypoint( function(direction) {
            if(direction === 'down') {
                setActiveState($("a[href='"+window.location.href.split('#')[0]+"#"+$(this.element).data("edgtf-anchor")+"']"));
            }
        }, { offset: '50%' });

        $('[data-edgtf-anchor]').waypoint( function(direction) {
            if(direction === 'up') {
                setActiveState($("a[href='"+window.location.href.split('#')[0]+"#"+$(this.element).data("edgtf-anchor")+"']"));
            }
        }, { offset: function(){
            return -($(this.element).outerHeight() - 150);
        } });

    };

    /**
     * Check anchor active state on load
     */
    var checkActiveStateOnLoad = function(){
        var hash = window.location.hash.split('#')[1];

        if(hash !== "" && $('[data-edgtf-anchor="'+hash+'"]').length > 0){
            //triggers click which is handled in 'anchorClick' function
            $("a[href='"+window.location.href.split('#')[0]+"#"+hash).trigger( "click" );
        }
    };

    /**
     * Calculate header height to be substract from scroll amount
     * @param anchoredElementOffset, anchorded element offest
     */
    var headerHeihtToSubtract = function(anchoredElementOffset){

        if(edgtf.modules.header.behaviour == 'edgtf-sticky-header-on-scroll-down-up') {
            (anchoredElementOffset > edgtf.modules.header.stickyAppearAmount) ? edgtf.modules.header.isStickyVisible = true : edgtf.modules.header.isStickyVisible = false;
        }

        if(edgtf.modules.header.behaviour == 'edgtf-sticky-header-on-scroll-up') {
            (anchoredElementOffset > edgtf.scroll) ? edgtf.modules.header.isStickyVisible = false : '';
        }

        var headerHeight = edgtf.modules.header.isStickyVisible ? edgtfQuadricGlobalVars.vars.edgtfStickyHeaderTransparencyHeight : edgtfPerPageVars.vars.edgtfHeaderTransparencyHeight;

        return headerHeight;
    };

    /**
     * Handle anchor click
     */
    var anchorClick = function() {
        edgtf.document.on("click", ".edgtf-main-menu a, .edgtf-vertical-menu a, .edgtf-fullscreen-menu a, .edgtf-btn, .edgtf-anchor, .edgtf-mobile-nav a", function() {
            var scrollAmount;
            var anchor = $(this);
            var hash = anchor.prop("hash").split('#')[1];

            if(hash !== "" && $('[data-edgtf-anchor="' + hash + '"]').length > 0 && anchor.attr('href').split('#')[0] == window.location.href.split('#')[0]) {

                var anchoredElementOffset = $('[data-edgtf-anchor="' + hash + '"]').offset().top;
                scrollAmount = $('[data-edgtf-anchor="' + hash + '"]').offset().top - headerHeihtToSubtract(anchoredElementOffset);

                setActiveState(anchor);

                edgtf.html.stop().animate({
                    scrollTop: Math.round(scrollAmount)
                }, 1000, function() {
                    //change hash tag in url
                    if(history.pushState) { history.pushState(null, null, '#'+hash); }
                });
                return false;
            }
        });
    };

    return {
        init: function() {
            if($('[data-edgtf-anchor]').length) {
                anchorClick();
                checkActiveStateOnScroll();
                $(window).on('load', function() { checkActiveStateOnLoad(); });
            }
        }
    };

};

/*
 **	Video background initialization
 */
function edgtfInitVideoBackground(){

    $('.edgtf-section .edgtf-video-wrap .edgtf-video').mediaelementplayer({
        enableKeyboard: false,
        iPadUseNativeControls: false,
        pauseOtherPlayers: false,
        // force iPhone's native controls
        iPhoneUseNativeControls: false,
        // force Android's native controls
        AndroidUseNativeControls: false
    });

    //mobile check
    if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
        edgtfInitVideoBackgroundSize();
        $('.edgtf-section .edgtf-mobile-video-image').show();
        $('.edgtf-section .edgtf-video-wrap').remove();
    }
}

    /*
     **	Calculate video background size
     */
    function edgtfInitVideoBackgroundSize(){

        $('.edgtf-section .edgtf-video-wrap').each(function(){

            var element = $(this);
            var sectionWidth = element.closest('.edgtf-section').outerWidth();
            element.width(sectionWidth);

            var sectionHeight = element.closest('.edgtf-section').outerHeight();
            edgtf.minVideoWidth = edgtf.videoRatio * (sectionHeight+20);
            element.height(sectionHeight);

            var scaleH = sectionWidth / edgtf.videoWidthOriginal;
            var scaleV = sectionHeight / edgtf.videoHeightOriginal;
            var scale =  scaleV;
            if (scaleH > scaleV)
                scale =  scaleH;
            if (scale * edgtf.videoWidthOriginal < edgtf.minVideoWidth) {scale = edgtf.minVideoWidth / edgtf.videoWidthOriginal;}

            element.find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * edgtf.videoWidthOriginal +2));
            element.find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * edgtf.videoHeightOriginal +2));
            element.scrollLeft((element.find('video').width() - sectionWidth) / 2);
            element.find('.mejs-overlay, .mejs-poster').scrollTop((element.find('video').height() - (sectionHeight)) / 2);
            element.scrollTop((element.find('video').height() - sectionHeight) / 2);
        });

    }

    /*
     **	Set content bottom margin because of the uncovering footer
     */
    function edgtfSetContentBottomMargin(){
        var uncoverFooter = $('.edgtf-footer-uncover');

        if(uncoverFooter.length){
            $('.edgtf-content').css('margin-bottom', $('.edgtf-footer-inner').height());
        }
    }

	/*
	 **	Set footer top height
	 */
	function edgtfFooterHeight(){
		var footerTop = $('.edgtf-footer-top-holder');

		if(footerTop.length) {

			if(edgtf.windowWidth > 1024) {
				var maxHeight;

				footerTop.find('.edgtf-column').each(function () {
					var element = $(this);
					maxHeight = maxHeight > element.height() ? maxHeight : element.height();
				});

				footerTop.find('.edgtf-column-inner').height(maxHeight);
			} else {
				footerTop.find('.edgtf-column-inner').height('auto');
			}
		}
	}

	/*
	** Initiate Smooth Scroll
	*/
	function edgtfSmoothScroll(){

		if(edgtf.body.hasClass('edgtf-smooth-scroll')){

			var scrollTime = 0.4;			//Scroll time
			var scrollDistance = 300;		//Distance. Use smaller value for shorter scroll and greater value for longer scroll

			var mobile_ie = -1 !== navigator.userAgent.indexOf("IEMobile");

			var smoothScrollListener = function(event){
				event.preventDefault();

				var delta = event.wheelDelta / 120 || -event.detail / 3;
				var scrollTop = edgtf.window.scrollTop();
				var finalScroll = scrollTop - parseInt(delta * scrollDistance);

				TweenLite.to(edgtf.window, scrollTime, {
					scrollTo: {
						y: finalScroll, autoKill: !0
					},
					ease: Power1.easeOut,
					autoKill: !0,
					overwrite: 5
				});
			};

			if (!$('html').hasClass('touch') && !mobile_ie) {
				if (window.addEventListener) {
					window.addEventListener('mousewheel', smoothScrollListener, {passive:false});
					window.addEventListener('DOMMouseScroll', smoothScrollListener, {passive:false});
				}
			}
		}
	}

    function edgtfDisableScroll() {


        if (window.addEventListener) {
            window.addEventListener('DOMMouseScroll', edgtfWheel, false);
        }
        window.onmousewheel = document.onmousewheel = edgtfWheel;
        document.onkeydown = edgtfKeydown;

        if(edgtf.body.hasClass('edgtf-smooth-scroll')){
            window.removeEventListener('mousewheel', smoothScrollListener, false);
            window.removeEventListener('DOMMouseScroll', smoothScrollListener, false);
        }
    }

    function edgtfEnableScroll() {
        if (window.removeEventListener) {
            window.removeEventListener('DOMMouseScroll', edgtfWheel, false);
        }
        window.onmousewheel = document.onmousewheel = document.onkeydown = null;

        if(edgtf.body.hasClass('edgtf-smooth-scroll')){
            window.addEventListener('mousewheel', smoothScrollListener, false);
            window.addEventListener('DOMMouseScroll', smoothScrollListener, false);
        }
    }

    function edgtfWheel(e) {
        edgtfPreventDefaultValue(e);
    }

    function edgtfKeydown(e) {
        var keys = [37, 38, 39, 40];

        for (var i = keys.length; i--;) {
            if (e.keyCode === keys[i]) {
                edgtfPreventDefaultValue(e);
                return;
            }
        }
    }

    function edgtfPreventDefaultValue(e) {
        e = e || window.event;
        if (e.preventDefault) {
            e.preventDefault();
        }
        e.returnValue = false;
    }

    function edgtfInitSelfHostedVideoPlayer() {

        var players = $('.edgtf-self-hosted-video');
            players.mediaelementplayer({
                audioWidth: '100%'
            });
    }

	function edgtfSelfHostedVideoSize(){

		$('.edgtf-self-hosted-video-holder .edgtf-video-wrap').each(function(){
			var thisVideo = $(this);

			var videoWidth = thisVideo.closest('.edgtf-self-hosted-video-holder').outerWidth();
			var videoHeight = videoWidth / edgtf.videoRatio;

			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
				thisVideo.parent().width(videoWidth);
				thisVideo.parent().height(videoHeight);
			}

			thisVideo.width(videoWidth);
			thisVideo.height(videoHeight);

			thisVideo.find('video, .mejs-overlay, .mejs-poster').width(videoWidth);
			thisVideo.find('video, .mejs-overlay, .mejs-poster').height(videoHeight);
		});
	}

    function edgtfToTopButton(a) {
        
        var b = $("#edgtf-back-to-top");
        b.removeClass('off on');
        if (a === 'on') { b.addClass('on'); } else { b.addClass('off'); }
    }

    function edgtfBackButtonShowHide(){
        edgtf.window.scroll(function () {
            var b = $(this).scrollTop();
            var c = $(this).height();
            var d;
            if (b > 0) { d = b + c / 2; } else { d = 1; }
            if (d < 1e3) { edgtfToTopButton('off'); } else { edgtfToTopButton('on'); }
        });
    }

    function edgtfInitBackToTop(){
        var backToTopButton = $('#edgtf-back-to-top');
        backToTopButton.on('click',function(e){
            e.preventDefault();
            edgtf.html.animate({scrollTop: 0}, edgtf.window.scrollTop()/3, 'linear');
        });
    }


    function edgtfCheckSVG(element) {
        var el = element;
        var drawingEnabled = el.data('svg-drawing');
        var animationDelay;

        if(typeof el.data('animation-delay') !== 'undefined') {
            animationDelay = el.data('animation-delay');
        }

        if (drawingEnabled == 'yes') {
            edgtfDrawSVG(el, animationDelay);
        }

    }

    /**
     * Function for drawing slider svgs. Based on Codrops article 'SVG Drawing Animation'
     */
    function edgtfDrawSVG(svg, delay) {

        var animationDelay = typeof delay !== 'undefined' ? delay : 0;


        var svgs = Array.prototype.slice.call( svg.find('svg') ),
            svgArr = new Array(),
            resizeTimeout;
        // the svgs already shown...

        svgs.forEach( function( el, i ) {
            var svg = new SVGEl( el );
            svgArr[i] = svg;
            setTimeout(function( el ) {
                return function() {
                    svg.render();
                };
            }( el ), animationDelay );//0ms pause before drawing
        } );
    }

    var docElem = window.document.documentElement;
    window.requestAnimFrame = function(){

        return (
            window.requestAnimationFrame       ||
            window.webkitRequestAnimationFrame ||
            window.mozRequestAnimationFrame    ||
            window.oRequestAnimationFrame      ||
            window.msRequestAnimationFrame     ||
            function(/* function */ callback){
                window.setTimeout(callback, 1000 / 60);
            }
        );
    }();
    window.cancelAnimFrame = function(){

        return (
            window.cancelAnimationFrame       ||
            window.webkitCancelAnimationFrame ||
            window.mozCancelAnimationFrame    ||
            window.oCancelAnimationFrame      ||
            window.msCancelAnimationFrame     ||
            function(id){
                window.clearTimeout(id);
            }
        );
    }();
    function SVGEl( el ) {

        this.el = el;
        var frameRate = $(this.el).closest('.edgtf-svg-frames-class').data('svg-frames');
        this.image = this.el.previousElementSibling;
        this.current_frame = 0;
        this.total_frames = frameRate;//number of frames defines speed of drawing
        this.path = new Array();
        this.length = new Array();
        this.handle = 0;
        this.init();
    }
    SVGEl.prototype.init = function() {

        var self = this;
        [].slice.call( this.el.querySelectorAll( 'path' ) ).forEach( function( path, i ) {
            self.path[i] = path;
            var l = self.path[i].getTotalLength();
            self.length[i] = l;
            self.path[i].style.strokeDasharray = l + ' ' + l;
            self.path[i].style.strokeDashoffset = l;
        } );
    };
    SVGEl.prototype.render = function() {

        if( this.rendered ) return;
        this.rendered = true;
        this.draw();
    };
    SVGEl.prototype.draw = function() {

        var self = this,
            progress = this.current_frame/this.total_frames;
        if (progress > 1) {
            window.cancelAnimFrame(this.handle);
        } else {
            this.current_frame++;
            for(var j=0, len = this.path.length; j<len;j++){
                this.path[j].style.strokeDashoffset = Math.floor(this.length[j] * (1 - progress));
            }
            this.handle = window.requestAnimFrame(function() { self.draw(); });
        }
    };

	/**
	 *	Floating Background Script - start
	 */
	function edgtfSetFloatingBackground() {

		if ($('.edgtf-section .edgtf-section-background-elements').length) {
			window.qfb = new function() {
				this.$sections = $('.edgtf-section .edgtf-section-background-elements');

				this.init = function() {
					qfb.$sections.each(function() {
						var big_dim = Math.max($(this).outerHeight(), $(this).outerWidth()) * 3;
						$(this).find('.edgtf-section-background-elements-inner').css({
							'width': big_dim + 'px',
							'height': big_dim + 'px',
							'margin-left': -big_dim/2 + 'px',
							'margin-top': -big_dim/2 + 'px',
						});
						qfb.floatBackgroundElements($(this));
					});
				};

				this.floatBackgroundElements = function($section) {
					$section.find('.floater').remove();
					var floater = {
						width: $section.data('floaterwidth'),
						height: $section.data('floaterheight'),
						src: $section.data('floatersrc'),
						speed: $section.data('floaterspeed'),
					};
					var dir = $section.data('dir'); // Direction
					var zigzag = ($section.data('zigzag') == "yes") ? -1 : 1; // Movement in opposite directions
					var randsize = ($section.data('randsize') == "yes") ? 1 : 0; // Random scales of background element
					var final_offset = {
						x: 0,
						y: 0,
					};
					var big_dimension = $section.find('.edgtf-section-background-elements-inner').width();
					var max_offset = big_dimension / 2;
					var distance = {
						x: 0,
						y: 0,
					};
					var path_rotation = 0;
					var change_duration = qfb.change_duration;

					switch (dir) {
						case "top-bottom": case "bottom-top":
						distance.x = 2 * floater.height;
						distance.y = 1.4 * floater.width;
						path_rotation = 90;
						break;

						case "left-right": case "right-left":
						distance.x = 2 * floater.width;
						distance.y = 1.4 * floater.height;
						path_rotation = 0;
						break;

						case "top-left-bottom-right": case "bottom-right-top-left": case "top-right-bottom-left": case "bottom-left-top-right":
						distance.x = 1.7 * Math.pow(floater.width*floater.width + floater.height*floater.height, 0.5);
						distance.y = 1.1 * Math.pow(floater.width*floater.width + floater.height*floater.height, 0.5);
						max_offset *= 1.44;
						path_rotation = -45;
						case "top-right-bottom-left": case "bottom-left-top-right":
						path_rotation = 45;
						break;
					}

					// Positioning the background elements - Start
					var coords = [ [], [] ];
					for (var y = 0, i = 0; y < max_offset; y += distance.y, i++) {
						for (var x = (i%2)*distance.x/2; x < max_offset; x += distance.x) {
							coords[i%2].push({x: x, y: y});
							if (x) coords[i%2].push({x: -x, y: y});
							if (y) coords[i%2].push({x: x, y: -y});
							if (x&&y) coords[i%2].push({x: -x, y: -y});
						}
					}
					for (var j=0; j<2; j++) {
						var floaters_html = "";
						for (var i=0; i<coords[j].length; i++) {
							var r = Math.pow(coords[j][i].x*coords[j][i].x + coords[j][i].y*coords[j][i].y, 0.5);
							var f = ( (coords[j][i].y) ? (Math.atan(coords[j][i].y / coords[j][i].x) + (coords[j][i].x < 0)*Math.PI) : ((coords[j][i].x < 0) ? -Math.PI : 0) ) + path_rotation/180*Math.PI;
							coords[j][i] = {
								x: (r * Math.cos(f) + distance.x/2) / big_dimension * 100 + 50,
								y: (-r * Math.sin(f) + distance.y/2) / big_dimension * 100 + 50,
							};
							floaters_html +=
								'<div class="floater" style="top: '+coords[j][i].y+'%; left: '+coords[j][i].x+'%; -webkit-transform: translate(-50%,-50%) scale('+(randsize ? (Math.random()*0.6+0.4) : 1)+'); transform: translate(-50%,-50%) scale('+(randsize ? (Math.random()*0.6+0.4) : 1)+'); ">' +
								'<img src="'+floater.src+'">' +
								'</div>'
							;
						}
						$section.find('.edgtf-section-background-elements-inner.edgtf-s-bei-'+(j+1)).html(floaters_html);
					}
					// Positioning the background elements - End

					if (dir == "top-bottom" || dir == "top-right-bottom-left" || dir == "top-left-bottom-right") final_offset.y = 1;
					else if (dir == "bottom-top" || dir == "bottom-left-top-right" || dir == "bottom-right-top-left") final_offset.y = -1;
					else final_offset.y = 0;
					if (dir == "left-right" || dir == "top-left-bottom-right" || dir == "bottom-left-top-right") final_offset.x = 1;
					else if (dir == "right-left" || dir == "top-right-bottom-left" || dir == "bottom-right-top-left") final_offset.x = -1;
					else final_offset.x = 0;
					var shift_x = big_dimension/3*final_offset.x, shift_y = big_dimension/3*final_offset.y;
					var transition_duration = Math.round(Math.pow(shift_x*shift_x + shift_y*shift_y, 0.5) / floater.speed);
					$section.find('.edgtf-section-background-elements-inner').css({
						'-webkit-transition': '-webkit-transform '+transition_duration+'s linear',
						'transition': 'transform '+transition_duration+'s linear',
					});
					$section.find('.edgtf-section-background-elements-inner.edgtf-s-bei-1').addClass('running').css({
						'-webkit-transform':'translate('+shift_x+'px, '+shift_y+'px)',
						'transform':'translate('+shift_x+'px, '+shift_y+'px)',
					});
					$section.find('.edgtf-section-background-elements-inner.edgtf-s-bei-2').addClass('running').css({
						'-webkit-transform': 'translate('+(shift_x*zigzag)+'px, '+(shift_y*zigzag)+'px)',
						'transform': 'translate('+(shift_x*zigzag)+'px, '+(shift_y*zigzag)+'px)',
					});
				};
			};

			qfb.init();
		}
	}
	/**
	 *	Floating Background Script - end
	 */

	function edgtfSmoothTransition() {

		if (edgtf.body.hasClass('edgtf-smooth-page-transitions')) {
            $(window).focus(function() {
                $('.edgtf-wrapper-inner').fadeIn(0);
            });
			$('a').on('click', function(e) {
				var a = $(this);
				var hash = a.prop("hash").split('#')[1];
				if (
                    e.which == 1 && // check if the left mouse button has been pressed
                    (typeof a.data('rel') === 'undefined') && //Not pretty photo link
                    a.attr('href').indexOf(window.location.host) >= 0 && // check if the link is to the same domain
					(hash === undefined) && //Not anchor
                    (typeof a.attr('target') === 'undefined' || a.attr('target') === '_self') // check if the link opens in the same window
				) {
					e.preventDefault();
					$('.edgtf-wrapper-inner').fadeOut(1000, function() {
						window.location = a.attr('href');
					});
				}
			});
		}
	}

})(jQuery);



(function($) {
    "use strict";

    var header = {};
    edgtf.modules.header = header;

    header.isStickyVisible = false;
    header.stickyAppearAmount = 0;
    header.behaviour;
    header.edgtfSideArea = edgtfSideArea;
	header.edgtfSideAreaScroll = edgtfSideAreaScroll;
    header.edgtfFullscreenMenu = edgtfFullscreenMenu;
    header.edgtfInitMobileNavigation = edgtfInitMobileNavigation;
    header.edgtfMobileHeaderBehavior = edgtfMobileHeaderBehavior;
    header.edgtfSetDropDownMenuPosition = edgtfSetDropDownMenuPosition;
    header.edgtfDropDownMenu = edgtfDropDownMenu;
    header.edgtfSearch = edgtfSearch;

    $(document).ready(function() {
        edgtfHeaderBehaviour();
        edgtfSideArea();
		edgtfSideAreaScroll();
        edgtfFullscreenMenu();
        edgtfInitMobileNavigation();
        edgtfMobileHeaderBehavior();
        edgtfSetDropDownMenuPosition();
        edgtfDropDownMenu();
        edgtfSearch();
        edgtfVerticalMenu().init();
    });

    $(window).on('load', function() {
        edgtfSetDropDownMenuPosition();
    });

    $(window).resize(function() {
        edgtfDropDownMenu();
    });

    /*
     **	Show/Hide sticky header on window scroll
     */
    function edgtfHeaderBehaviour() {

        var header = $('.edgtf-page-header');
        var stickyHeader = $('.edgtf-sticky-header');
        var fixedHeaderWrapper = $('.edgtf-fixed-wrapper');

        var headerMenuAreaOffset = $('.edgtf-page-header').find('.edgtf-fixed-wrapper').length ? $('.edgtf-page-header').find('.edgtf-fixed-wrapper').offset().top : null;

        var stickyAppearAmount;


        switch(true) {
            // sticky header that will be shown when user scrolls up
            case edgtf.body.hasClass('edgtf-sticky-header-on-scroll-up'):
                edgtf.modules.header.behaviour = 'edgtf-sticky-header-on-scroll-up';
                var docYScroll1 = $(document).scrollTop();
                stickyAppearAmount = edgtfQuadricGlobalVars.vars.edgtfTopBarHeight + edgtfQuadricGlobalVars.vars.edgtfLogoAreaHeight + edgtfQuadricGlobalVars.vars.edgtfMenuAreaHeight + edgtfQuadricGlobalVars.vars.edgtfStickyHeaderHeight;

                var headerAppear = function(){
                    var docYScroll2 = $(document).scrollTop();

                    if((docYScroll2 > docYScroll1 && docYScroll2 > stickyAppearAmount) || (docYScroll2 < stickyAppearAmount)) {
                        edgtf.modules.header.isStickyVisible= false;
                        stickyHeader.removeClass('header-appear').find('.edgtf-main-menu .second').removeClass('edgtf-drop-down-start');
                    }else {
                        edgtf.modules.header.isStickyVisible = true;
                        stickyHeader.addClass('header-appear');
                    }

                    docYScroll1 = $(document).scrollTop();
                };
                headerAppear();

                $(window).scroll(function() {
                    headerAppear();
                });

                break;

            // sticky header that will be shown when user scrolls both up and down
            case edgtf.body.hasClass('edgtf-sticky-header-on-scroll-down-up'):
                edgtf.modules.header.behaviour = 'edgtf-sticky-header-on-scroll-down-up';
                stickyAppearAmount = edgtfPerPageVars.vars.edgtfStickyScrollAmount !== 0 ? edgtfPerPageVars.vars.edgtfStickyScrollAmount : edgtfQuadricGlobalVars.vars.edgtfTopBarHeight + edgtfQuadricGlobalVars.vars.edgtfLogoAreaHeight + edgtfQuadricGlobalVars.vars.edgtfMenuAreaHeight;
                edgtf.modules.header.stickyAppearAmount = stickyAppearAmount; //used in anchor logic
                
                var headerAppear = function(){
                    if(edgtf.scroll < stickyAppearAmount) {
                        edgtf.modules.header.isStickyVisible = false;
                        stickyHeader.removeClass('header-appear').find('.edgtf-main-menu .second').removeClass('edgtf-drop-down-start');
                    }else{
                        edgtf.modules.header.isStickyVisible = true;
                        stickyHeader.addClass('header-appear');
                    }
                };

                headerAppear();

                $(window).scroll(function() {
                    headerAppear();
                });

                break;

            // on scroll down, part of header will be sticky
            case edgtf.body.hasClass('edgtf-fixed-on-scroll'):
                edgtf.modules.header.behaviour = 'edgtf-fixed-on-scroll';
                var headerFixed = function(){
                    if(edgtf.scroll <= headerMenuAreaOffset){
                        fixedHeaderWrapper.removeClass('fixed');
                        header.css('margin-bottom',0);}
                    else{
                        fixedHeaderWrapper.addClass('fixed');
                        header.css('margin-bottom',fixedHeaderWrapper.height());
                    }
                };

                headerFixed();

                $(window).scroll(function() {
                    headerFixed();
                });

                break;
        }
    }

    /**
     * Show/hide side area
     */
    function edgtfSideArea() {

        var wrapper = $('.edgtf-wrapper'),
            sideMenu = $('.edgtf-side-menu'),
            sideMenuButtonOpen = $('a.edgtf-side-menu-button-opener'),
            cssClass,
        //Flags
            slideFromRight = false,
            slideWithContent = false,
            slideUncovered = false;

        if (edgtf.body.hasClass('edgtf-side-menu-slide-from-right')) {

            cssClass = 'edgtf-right-side-menu-opened';
            wrapper.prepend('<div class="edgtf-cover"/>');
            slideFromRight = true;

        } else if (edgtf.body.hasClass('edgtf-side-menu-slide-with-content')) {

            cssClass = 'edgtf-side-menu-open';
            slideWithContent = true;

        } else if (edgtf.body.hasClass('edgtf-side-area-uncovered-from-content')) {

            cssClass = 'edgtf-right-side-menu-opened';
            slideUncovered = true;

        }

        $('a.edgtf-side-menu-button-opener, a.edgtf-close-side-menu').on('click', function(e) {
            e.preventDefault();

            if(!sideMenuButtonOpen.hasClass('opened')) {

                sideMenuButtonOpen.addClass('opened');
                edgtf.body.addClass(cssClass);

                if (slideFromRight) {
                    $('.edgtf-wrapper .edgtf-cover').on('click', function() {
                        edgtf.body.removeClass('edgtf-right-side-menu-opened');
                        sideMenuButtonOpen.removeClass('opened');
                    });
                }

                if (slideUncovered) {
                    sideMenu.css({
                        'visibility' : 'visible'
                    });
                }

                var currentScroll = $(window).scrollTop();
                $(window).scroll(function() {
                    if(Math.abs(edgtf.scroll - currentScroll) > 400){
                        edgtf.body.removeClass(cssClass);
                        sideMenuButtonOpen.removeClass('opened');
                        if (slideUncovered) {
                            var hideSideMenu = setTimeout(function(){
                                sideMenu.css({'visibility':'hidden'});
                                clearTimeout(hideSideMenu);
                            },400);
                        }
                    }
                });

            } else {

                sideMenuButtonOpen.removeClass('opened');
                edgtf.body.removeClass(cssClass);
                if (slideUncovered) {
                    var hideSideMenu = setTimeout(function(){
                        sideMenu.css({'visibility':'hidden'});
                        clearTimeout(hideSideMenu);
                    },400);
                }

            }

            if (slideWithContent) {

                e.stopPropagation();
                wrapper.on('click', function() {
                    e.preventDefault();
                    sideMenuButtonOpen.removeClass('opened');
                    edgtf.body.removeClass('edgtf-side-menu-open');
                });

            }

        });

    }

	/*
	 **  Smooth scroll functionality for Side Area
	 */
	function edgtfSideAreaScroll(){

		var sideMenu = $('.edgtf-side-menu');

		if(sideMenu.length){
			sideMenu.niceScroll({
				scrollspeed: 60,
				mousescrollstep: 40,
				cursorwidth: 0,
				cursorborder: 0,
				cursorborderradius: 0,
				cursorcolor: "transparent",
				autohidemode: false,
				horizrailenabled: false
			});
		}
	}

    /**
     * Init Fullscreen Menu
     */
    function edgtfFullscreenMenu() {

        if ($('a.edgtf-fullscreen-menu-opener').length) {

            var popupMenuOpener = $( 'a.edgtf-fullscreen-menu-opener'),
                popupMenuHolderOuter = $(".edgtf-fullscreen-menu-holder-outer"),
                cssClass,
            //Flags for type of animation
                fadeRight = false,
                fadeTop = false,
            //Widgets
                widgetAboveNav = $('.edgtf-fullscreen-above-menu-widget-holder'),
                widgetBelowNav = $('.edgtf-fullscreen-below-menu-widget-holder'),
            //Menu
                menuItems = $('.edgtf-fullscreen-menu-holder-outer nav > ul > li > a'),
                menuItemWithChild =  $('.edgtf-fullscreen-menu > ul li.has_sub > a'),
                menuItemWithoutChild = $('.edgtf-fullscreen-menu ul li:not(.has_sub) a');


            //set height of popup holder and initialize nicescroll
            popupMenuHolderOuter.height(edgtf.windowHeight).niceScroll({
                scrollspeed: 30,
                mousescrollstep: 20,
                cursorwidth: 0,
                cursorborder: 0,
                cursorborderradius: 0,
                cursorcolor: "transparent",
                autohidemode: false,
                horizrailenabled: false
            }); //200 is top and bottom padding of holder

            //set height of popup holder on resize
            $(window).resize(function() {
                popupMenuHolderOuter.height(edgtf.windowHeight);
            });

            if (edgtf.body.hasClass('edgtf-fade-push-text-right')) {
                cssClass = 'edgtf-push-nav-right';
                fadeRight = true;
            } else if (edgtf.body.hasClass('edgtf-fade-push-text-top')) {
                cssClass = 'edgtf-push-text-top';
                fadeTop = true;
            }

            //Appearing animation
            if (fadeRight || fadeTop) {
                if (widgetAboveNav.length) {
                    widgetAboveNav.children().css({
                        '-webkit-animation-delay' : 0 + 'ms',
                        '-moz-animation-delay' : 0 + 'ms',
                        'animation-delay' : 0 + 'ms'
                    });
                }
                menuItems.each(function(i) {
                    $(this).css({
                        '-webkit-animation-delay': (i+1) * 70 + 'ms',
                        '-moz-animation-delay': (i+1) * 70 + 'ms',
                        'animation-delay': (i+1) * 70 + 'ms'
                    });
                });
                if (widgetBelowNav.length) {
                    widgetBelowNav.children().css({
                        '-webkit-animation-delay' : (menuItems.length + 1)*70 + 'ms',
                        '-moz-animation-delay' : (menuItems.length + 1)*70 + 'ms',
                        'animation-delay' : (menuItems.length + 1)*70 + 'ms'
                    });
                }
            }

            // Open popup menu
            popupMenuOpener.on('click',function(e){
                e.preventDefault();

                if (!popupMenuOpener.hasClass('opened')) {
                    popupMenuOpener.addClass('opened');
                    edgtf.body.addClass('edgtf-fullscreen-menu-opened');
                    edgtf.body.removeClass('edgtf-fullscreen-fade-out').addClass('edgtf-fullscreen-fade-in');
                    edgtf.body.removeClass(cssClass);
                    if(!edgtf.body.hasClass('page-template-full_screen-php')){
                        edgtf.modules.common.edgtfDisableScroll();
                    }
                    $(document).keyup(function(e){
                        if (e.keyCode == 27 ) {
                            popupMenuOpener.removeClass('opened');
                            edgtf.body.removeClass('edgtf-fullscreen-menu-opened');
                            edgtf.body.removeClass('edgtf-fullscreen-fade-in').addClass('edgtf-fullscreen-fade-out');
                            edgtf.body.addClass(cssClass);
                            if(!edgtf.body.hasClass('page-template-full_screen-php')){
                                edgtf.modules.common.edgtfEnableScroll();
                            }
                            $("nav.edgtf-fullscreen-menu ul.sub_menu").slideUp(200, function(){
                                $('nav.popup_menu').getNiceScroll().resize();
                            });
                        }
                    });
                } else {
                    popupMenuOpener.removeClass('opened');
                    edgtf.body.removeClass('edgtf-fullscreen-menu-opened');
                    edgtf.body.removeClass('edgtf-fullscreen-fade-in').addClass('edgtf-fullscreen-fade-out');
                    edgtf.body.addClass(cssClass);
                    if(!edgtf.body.hasClass('page-template-full_screen-php')){
                        edgtf.modules.common.edgtfEnableScroll();
                    }
                    $("nav.edgtf-fullscreen-menu ul.sub_menu").slideUp(200, function(){
                        $('nav.popup_menu').getNiceScroll().resize();
                    });
                }
            });

            //logic for open sub menus in popup menu
            menuItemWithChild.on('tap click', function(e) {
                e.preventDefault();

                if ($(this).parent().hasClass('has_sub')) {
                    var submenu = $(this).parent().find('> ul.sub_menu');
                    if (submenu.is(':visible')) {
                        submenu.slideUp(200, function() {
                            popupMenuHolderOuter.getNiceScroll().resize();
                        });
                        $(this).parent().removeClass('open_sub');
                    } else {
                        $(this).parent().addClass('open_sub');
                        submenu.slideDown(200, function() {
                            popupMenuHolderOuter.getNiceScroll().resize();
                        });
                    }
                }
                return false;
            });

            //if link has no submenu and if it's not dead, than open that link
            menuItemWithoutChild.on('click', function (e) {

                if(($(this).attr('href') !== "http://#") && ($(this).attr('href') !== "#")){

                    if (e.which == 1) {
                        popupMenuOpener.removeClass('opened');
                        edgtf.body.removeClass('edgtf-fullscreen-menu-opened');
                        edgtf.body.removeClass('edgtf-fullscreen-fade-in').addClass('edgtf-fullscreen-fade-out');
                        edgtf.body.addClass(cssClass);
                        $("nav.edgtf-fullscreen-menu ul.sub_menu").slideUp(200, function(){
                            $('nav.popup_menu').getNiceScroll().resize();
                        });
                        edgtf.modules.common.edgtfEnableScroll();
                    }
                }else{
                    return false;
                }

            });

        }



    }

    function edgtfInitMobileNavigation() {
        var navigationOpener = $('.edgtf-mobile-header .edgtf-mobile-menu-opener');
        var navigationHolder = $('.edgtf-mobile-header .edgtf-mobile-nav');
        var dropdownOpener = $('.edgtf-mobile-nav .mobile_arrow, .edgtf-mobile-nav h4, .edgtf-mobile-nav a[href*="#"]');
        var animationSpeed = 200;

        //whole mobile menu opening / closing
        if(navigationOpener.length && navigationHolder.length) {
            navigationOpener.on('tap click', function(e) {
                e.stopPropagation();
                e.preventDefault();

                if(navigationHolder.is(':visible')) {
                    navigationHolder.slideUp(animationSpeed);
                } else {
                    navigationHolder.slideDown(animationSpeed);
                }
            });
        }

        //dropdown opening / closing
	    if(dropdownOpener.length) {
		    dropdownOpener.each(function() {
			    $(this).on('tap click', function(e) {
				    var dropdownToOpen = $(this).nextAll('ul').first();

				    if(dropdownToOpen.length) {
					    e.preventDefault();
					    e.stopPropagation();

					    var openerParent = $(this).parent('li');
					    if(dropdownToOpen.is(':visible')) {
						    dropdownToOpen.slideUp(animationSpeed);
						    openerParent.removeClass('edgtf-opened');
					    } else {
						    dropdownToOpen.slideDown(animationSpeed);
						    openerParent.addClass('edgtf-opened');
					    }
				    }

			    });
		    });
	    }

        $('.edgtf-mobile-nav a, .edgtf-mobile-logo-wrapper a').on('click tap', function(e) {
            if($(this).attr('href') !== 'http://#' && $(this).attr('href') !== '#') {
                navigationHolder.slideUp(animationSpeed);
            }
        });
    }

    function edgtfMobileHeaderBehavior() {
        if(edgtf.body.hasClass('edgtf-sticky-up-mobile-header')) {
            var stickyAppearAmount;
            var mobileHeader = $('.edgtf-mobile-header');
            var adminBar     = $('#wpadminbar');
            var mobileHeaderHeight = mobileHeader.length ? mobileHeader.height() : 0;
            var adminBarHeight = adminBar.length ? adminBar.height() : 0;

            var docYScroll1 = $(document).scrollTop();
            stickyAppearAmount = mobileHeaderHeight + adminBarHeight;

            $(window).scroll(function() {
                var docYScroll2 = $(document).scrollTop();

                if(docYScroll2 > stickyAppearAmount) {
                    mobileHeader.addClass('edgtf-animate-mobile-header');
                } else {
                    mobileHeader.removeClass('edgtf-animate-mobile-header');
                }

                if((docYScroll2 > docYScroll1 && docYScroll2 > stickyAppearAmount) || (docYScroll2 < stickyAppearAmount)) {
                    mobileHeader.removeClass('mobile-header-appear');
                    mobileHeader.css('margin-bottom', 0);

                    if(adminBar.length) {
                        mobileHeader.find('.edgtf-mobile-header-inner').css('top', 0);
                    }
                } else {
                    mobileHeader.addClass('mobile-header-appear');
                    mobileHeader.css('margin-bottom', stickyAppearAmount);

                    //if(adminBar.length) {
                    //    mobileHeader.find('.edgtf-mobile-header-inner').css('top', adminBarHeight);
                    //}
                }

                docYScroll1 = $(document).scrollTop();
            });
        }

    }


    /**
     * Set dropdown position
     */
    function edgtfSetDropDownMenuPosition(){

        var menuItems = $(".edgtf-drop-down > ul > li.narrow");
        menuItems.each( function(i) {

            var browserWidth = edgtf.windowWidth-16; // 16 is width of scroll bar
            var menuItemPosition = $(this).offset().left;
            var dropdownMenuWidth = $(this).find('.second .inner ul').width();

            var menuItemFromLeft = 0;
            if(edgtf.body.hasClass('boxed')){
                menuItemFromLeft = edgtf.boxedLayoutWidth  - (menuItemPosition - (browserWidth - edgtf.boxedLayoutWidth )/2);
            } else {
                menuItemFromLeft = browserWidth - menuItemPosition;
            }

            var dropDownMenuFromLeft; //has to stay undefined beacuse 'dropDownMenuFromLeft < dropdownMenuWidth' condition will be true

            if($(this).find('li.sub').length > 0){
                dropDownMenuFromLeft = menuItemFromLeft - dropdownMenuWidth;
            }

            if(menuItemFromLeft < dropdownMenuWidth || dropDownMenuFromLeft < dropdownMenuWidth){
                $(this).find('.second').addClass('right');
                $(this).find('.second .inner ul').addClass('right');
            }
        });

    }


    function edgtfDropDownMenu() {

        var menu_items = $('.edgtf-drop-down > ul > li');

        menu_items.each(function(i) {
            if($(menu_items[i]).find('.second').length > 0) {

                var dropDownSecondDiv = $(menu_items[i]).find('.second');

                if($(menu_items[i]).hasClass('wide')) {

                    var dropdown = $(this).find('.inner > ul');
                    var dropdownPadding = parseInt(dropdown.css('padding-left').slice(0, -2)) + parseInt(dropdown.css('padding-right').slice(0, -2));
                    var dropdownWidth = dropdown.outerWidth();

                    if(!$(this).hasClass('left_position') && !$(this).hasClass('right_position')) {
                        dropDownSecondDiv.css('left', 0);
                    }

                    //set columns to be same height - start
                    var tallest = 0;
                    $(this).find('.second > .inner > ul > li').each(function() {
                        var thisHeight = '';
                        $(this).waitForImages(function(){
                            thisHeight = $(this).height();
                        });
                        if(thisHeight > tallest) {
                            tallest = thisHeight;
                        }
                    });
                    $(this).find('.second > .inner > ul > li').css("height", ""); // delete old inline css - via resize
                    $(this).find('.second > .inner > ul > li').height(tallest);
                    //set columns to be same height - end

                    if(!$(this).hasClass('wide_background')) {
                        if(!$(this).hasClass('left_position') && !$(this).hasClass('right_position')) {
                            var left_position = (edgtf.windowWidth - 2 * (edgtf.windowWidth - dropdown.offset().left)) / 2 + (dropdownWidth + dropdownPadding) / 2;
                            dropDownSecondDiv.css('left', -left_position);
                        }
                    } else {
                        if(!$(this).hasClass('left_position') && !$(this).hasClass('right_position')) {
                            var left_position = dropdown.offset().left;

                            dropDownSecondDiv.css('left', -left_position);
                            dropDownSecondDiv.css('width', edgtf.windowWidth);

                        }
                    }
                }

                if(!edgtf.menuDropdownHeightSet) {
                    $(menu_items[i]).data('original_height', dropDownSecondDiv.height() + 'px');
                    dropDownSecondDiv.height(0);
                }

                if(navigator.userAgent.match(/(iPod|iPhone|iPad)/)) {
                    $(menu_items[i]).on("touchstart mouseenter", function() {
                        dropDownSecondDiv.css({
                            'height': $(menu_items[i]).data('original_height'),
                            'overflow': 'visible',
                            'visibility': 'visible',
                            'opacity': '1'
                        });
                    }).on("mouseleave", function() {
                        dropDownSecondDiv.css({
                            'height': '0px',
                            'overflow': 'hidden',
                            'visibility': 'hidden',
                            'opacity': '0'
                        });
                    });

                } else {
                        $(menu_items[i]).mouseenter(function() {
                            dropDownSecondDiv.css({
                                'visibility': 'visible',
                                'height': '0px',
                                'opacity': '0',
                            });
                            dropDownSecondDiv.stop().animate({
                                'height': $(menu_items[i]).data('original_height'),
                                'opacity': '1',
                            }, 250, 'easeOutSine', function() {
                                dropDownSecondDiv.css('overflow', 'visible');
                            });
                        }).mouseleave(function() {
                            dropDownSecondDiv.stop().animate({
                                'opacity':'0'
                            }, 200, 'easeOutSine', function() {
                                dropDownSecondDiv.css({
                                    'overflow': 'hidden',
                                    'visibility': 'hidden',
                                    'height':'0px'
                                });
                            });
                        });
                }
            }
        });
        $('.edgtf-drop-down ul li.wide ul li a').on('click', function(e) {
			if (e.which == 1){
				var $this = $(this);
				setTimeout(function() {
					$this.mouseleave();
				}, 500);
			}

        });

        edgtf.menuDropdownHeightSet = true;
    }

    /**
     * Init Search Types
     */
    function edgtfSearch() {

        var searchOpener = $('a.edgtf-search-opener'),
            searchClose,
            searchForm,
            touch = false;

        if ( $('html').hasClass( 'touch' ) ) {
            touch = true;
        }

        if ( searchOpener.length > 0 ) {
            //Check for type of search
            if ( edgtf.body.hasClass( 'edgtf-fullscreen-search' ) ) {

                var fullscreenSearchFade = false,
                    fullscreenSearchFromCircle = false;

                searchClose = $( '.edgtf-fullscreen-search-close' );

                if (edgtf.body.hasClass('edgtf-search-fade')) {
                    fullscreenSearchFade = true;
                } else if (edgtf.body.hasClass('edgtf-search-from-circle')) {
                    fullscreenSearchFromCircle = true;
                }
                edgtfFullscreenSearch( fullscreenSearchFade, fullscreenSearchFromCircle );

            } else if ( edgtf.body.hasClass( 'edgtf-search-slides-from-window-top' ) ) {

                searchForm = $('.edgtf-search-slide-window-top');
                searchClose = $('.edgtf-search-close');
                edgtfSearchWindowTop();

            } else if ( edgtf.body.hasClass( 'edgtf-search-slides-from-header-bottom' ) ) {

                edgtfSearchHeaderBottom();

            } else if ( edgtf.body.hasClass( 'edgtf-search-covers-header' ) ) {

                edgtfSearchCoversHeader();

            }

        }

        /**
         * Search slides from window top type of search
         */
        function edgtfSearchWindowTop() {

            searchOpener.on('click', function(e) {
                e.preventDefault();

                if($('.title').hasClass('has_parallax_background')){
                    var yPos = parseInt($('.title.has_parallax_background').css('backgroundPosition').split(" ")[1]);
                }else {
                    var yPos = 0;
                }
                if ( searchForm.height() === 0) {
                    $('.edgtf-search-slide-window-top input[type="text"]').focus();
                    //Push header bottom
                    edgtf.body.addClass('edgtf-search-open');
                    $('.title.has_parallax_background').animate({
                        'background-position-y': (yPos + 50)+'px'
                    }, 150);
                } else {
                    edgtf.body.removeClass('edgtf-search-open');
                    $('.title.has_parallax_background').animate({
                        'background-position-y': (yPos - 50)+'px'
                    }, 150);
                }

                $(window).scroll(function() {
                    if ( searchForm.height() !== 0 && edgtf.scroll > 50 ) {
                        edgtf.body.removeClass('edgtf-search-open');
                        $('.title.has_parallax_background').css('backgroundPosition', 'center '+(yPos)+'px');
                    }
                });

                searchClose.on('click', function(e){
                    e.preventDefault();
                    edgtf.body.removeClass('edgtf-search-open');
                    $('.title.has_parallax_background').animate({
                        'background-position-y': (yPos)+'px'
                    }, 150);
                });

            });
        }

        /**
         * Search slides from header bottom type of search
         */
        function edgtfSearchHeaderBottom() {

            var searchInput = $('.edgtf-search-slide-header-bottom input[type="submit"]');

            searchOpener.on('click', function(e) {
                e.preventDefault();

                //If there is form openers in multiple widgets, only one search form should be opened
                if ( $(this).closest('.edgtf-mobile-header').length > 0 ) {
                    //    Open form in mobile header
                    searchForm = $(this).closest('.edgtf-mobile-header').children().children().first();
                } else if ( $(this).closest('.edgtf-sticky-header').length > 0 ) {
                    //    Open form in sticky header
                    searchForm= $(this).closest('.edgtf-sticky-header').children().first();
                } else {
                    //Open first form in header
                    searchForm = $('.edgtf-search-slide-header-bottom').first();
                }

                if( searchForm.hasClass( 'edgtf-animated' ) ) {
                    searchForm.removeClass('edgtf-animated');
                } else {
                    searchForm.addClass('edgtf-animated');
                }

                searchForm.addClass('edgtf-disabled');
                searchInput.attr('disabled','edgtf-disabled');
                if( ( $('.edgtf-search-slide-header-bottom .edgtf-search-field').val() !== '' ) && ( $('.edgtf-search-slide-header-bottom .edgtf-search-field').val() !== ' ' ) ) {
                    searchInput.removeAttr('edgtf-disabled');
                    searchForm.removeClass('edgtf-disabled');
                } else {
                    searchForm.addClass('edgtf-disabled');
                    searchInput.attr('disabled','edgtf-disabled');
                }

                $('.edgtf-search-slide-header-bottom .edgtf-search-field').keyup(function() {
                    if( ($(this).val() !== '' ) && ( $(this).val() != ' ') ) {
                        searchInput.removeAttr('edgtf-disabled');
                        searchForm.removeClass('edgtf-disabled');
                    }
                    else {
                        searchInput.attr('disabled','edgtf-disabled');
                        searchForm.addClass('edgtf-disabled');
                    }
                });

                $('.content, footer').on('click', function(e){
                    e.preventDefault();
                    searchForm.removeClass('edgtf-animated');
                });

            });

            //Submit form
            if($('.edgtf-search-submit').length) {
                $('.edgtf-search-submit').on('click', function(e) {
                    e.preventDefault();
                    e.stopPropagation();
                    searchForm.submit();
                });
            }
        }

        /**
         * Search covers header type of search
         */
        function edgtfSearchCoversHeader() {

            searchOpener.on('click', function(e) {
                e.preventDefault();
				var searchFormHeight,
					searchFormHolder = $('.edgtf-search-cover .edgtf-form-holder-outer'),
					searchForm,
					searchFormLandmark; // there is one more div element if header is in grid

				if($(this).closest('.edgtf-grid').length){
					searchForm = $(this).closest('.edgtf-grid').children().first();
					searchFormLandmark = searchForm.parent();
				}
				else{
					searchForm = $(this).closest('.edgtf-menu-area').children().first();
					searchFormLandmark = searchForm;
				}

                if ( $(this).closest('.edgtf-sticky-header').length > 0 ) {
                    searchForm = $(this).closest('.edgtf-sticky-header').children().first();
                }
                if ( $(this).closest('.edgtf-mobile-header').length > 0 ) {
                    searchForm = $(this).closest('.edgtf-mobile-header').children().children().first();
                }

                //Find search form position in header and height
                if ( searchFormLandmark.parent().hasClass('edgtf-logo-area') ) {
                    searchFormHeight = edgtfQuadricGlobalVars.vars.edgtfLogoAreaHeight;
                } else if ( searchFormLandmark.parent().hasClass('edgtf-top-bar') ) {
                    searchFormHeight = edgtfQuadricGlobalVars.vars.edgtfTopBarHeight;
                } else if ( searchFormLandmark.parent().hasClass('edgtf-menu-area') ) {
                    searchFormHeight = edgtfQuadricGlobalVars.vars.edgtfMenuAreaHeight;
                } else if ( searchFormLandmark.hasClass('edgtf-sticky-header') ) {
                    searchFormHeight = edgtfQuadricGlobalVars.vars.edgtfMenuAreaHeight;
                } else if ( searchFormLandmark.parent().hasClass('edgtf-mobile-header') ) {
                    searchFormHeight = $('.edgtf-mobile-header-inner').height();
                }

                searchFormHolder.height(searchFormHeight);
                searchForm.stop(true).fadeIn(600);
                $('.edgtf-search-cover input[type="text"]').focus();
                $('.edgtf-search-close, .content, footer').on('click', function(e){
                    e.preventDefault();
                    searchForm.stop(true).fadeOut(450);
                });
                searchForm.blur(function() {
                    searchForm.stop(true).fadeOut(450);
                });
            });

        }

        /**
         * Fullscreen search (two types: fade and from circle)
         */
        function edgtfFullscreenSearch( fade, fromCircle ) {

            var searchHolder = $( '.edgtf-fullscreen-search-holder'),
                searchOverlay = $( '.edgtf-fullscreen-search-overlay' );

            searchOpener.on('click', function(e) {
                e.preventDefault();
                var samePosition = false;
                if ( $(this).data('icon-close-same-position') === 'yes' ) {
                    var closeTop = $(this).offset().top;
                    var closeLeft = $(this).offset().left;
                    samePosition = true;
                }
                //Fullscreen search fade
                if ( fade ) {
                    if ( searchHolder.hasClass( 'edgtf-animate' ) ) {
                        edgtf.body.removeClass('edgtf-fullscreen-search-opened');
                        edgtf.body.addClass( 'edgtf-search-fade-out' );
                        edgtf.body.removeClass( 'edgtf-search-fade-in' );
                        searchHolder.removeClass( 'edgtf-animate' );
                        if(!edgtf.body.hasClass('page-template-full_screen-php')){
                            edgtf.modules.common.edgtfEnableScroll();
                        }
                    } else {
                        edgtf.body.addClass('edgtf-fullscreen-search-opened');
                        edgtf.body.removeClass('edgtf-search-fade-out');
                        edgtf.body.addClass('edgtf-search-fade-in');
                        searchHolder.addClass('edgtf-animate');
                        if (samePosition) {
                            searchClose.css({
                                'top' : closeTop - edgtf.scroll, // Distance from top of viewport ( distance from top of window - scroll distance )
                                'left' : closeLeft
                            });
                        }
                        if(!edgtf.body.hasClass('page-template-full_screen-php')){
                            edgtf.modules.common.edgtfDisableScroll();
                        }
                    }
                    searchClose.on('click', function(e) {
                        e.preventDefault();
                        edgtf.body.removeClass('edgtf-fullscreen-search-opened');
                        searchHolder.removeClass('edgtf-animate');
                        edgtf.body.removeClass('edgtf-search-fade-in');
                        edgtf.body.addClass('edgtf-search-fade-out');
                        if(!edgtf.body.hasClass('page-template-full_screen-php')){
                            edgtf.modules.common.edgtfEnableScroll();
                        }
                    });
                    //Close on escape
                    $(document).keyup(function(e){
                        if (e.keyCode == 27 ) { //KeyCode for ESC button is 27
                            edgtf.body.removeClass('edgtf-fullscreen-search-opened');
                            searchHolder.removeClass('edgtf-animate');
                            edgtf.body.removeClass('edgtf-search-fade-in');
                            edgtf.body.addClass('edgtf-search-fade-out');
                            if(!edgtf.body.hasClass('page-template-full_screen-php')){
                                edgtf.modules.common.edgtfEnableScroll();
                            }
                        }
                    });
                }
                //Fullscreen search from circle
                if ( fromCircle ) {
                    if( searchOverlay.hasClass('edgtf-animate') ) {
                        searchOverlay.removeClass('edgtf-animate');
                        searchHolder.css({
                            'opacity': 0,
                            'display':'none'
                        });
                        searchClose.css({
                            'opacity' : 0,
                            'visibility' : 'hidden'
                        });
                        searchOpener.css({
                            'opacity': 1
                        });
                    } else {
                        searchOverlay.addClass('edgtf-animate');
                        searchHolder.css({
                            'display':'block'
                        });
                        setTimeout(function(){
                            searchHolder.css('opacity','1');
                            searchClose.css({
                                'opacity' : 1,
                                'visibility' : 'visible',
                                'top' : closeTop - edgtf.scroll, // Distance from top of viewport ( distance from top of window - scroll distance )
                                'left' : closeLeft
                            });
                            if (samePosition) {
                                searchClose.css({
                                    'top' : closeTop - edgtf.scroll, // Distance from top of viewport ( distance from top of window - scroll distance )
                                    'left' : closeLeft
                                });
                            }
                            searchOpener.css({
                                'opacity' : 0
                            });
                        },200);
                        if(!edgtf.body.hasClass('page-template-full_screen-php')){
                            edgtf.modules.common.edgtfDisableScroll();
                        }
                    }
                    searchClose.on('click', function(e) {
                        e.preventDefault();
                        searchOverlay.removeClass('edgtf-animate');
                        searchHolder.css({
                            'opacity' : 0,
                            'display' : 'none'
                        });
                        searchClose.css({
                            'opacity':0,
                            'visibility' : 'hidden'
                        });
                        searchOpener.css({
                            'opacity' : 1
                        });
                        if(!edgtf.body.hasClass('page-template-full_screen-php')){
                            edgtf.modules.common.edgtfEnableScroll();
                        }
                    });
                    //Close on escape
                    $(document).keyup(function(e){
                        if (e.keyCode == 27 ) { //KeyCode for ESC button is 27
                            searchOverlay.removeClass('edgtf-animate');
                            searchHolder.css({
                                'opacity' : 0,
                                'display' : 'none'
                            });
                            searchClose.css({
                                'opacity':0,
                                'visibility' : 'hidden'
                            });
                            searchOpener.css({
                                'opacity' : 1
                            });
                            if(!edgtf.body.hasClass('page-template-full_screen-php')){
                                edgtf.modules.common.edgtfEnableScroll();
                            }
                        }
                    });
                }
            });

            //Text input focus change
            $('.edgtf-fullscreen-search-holder .edgtf-search-field').focus(function(){
                $('.edgtf-fullscreen-search-holder .edgtf-field-holder .edgtf-line').css("width","100%");
            });

            $('.edgtf-fullscreen-search-holder .edgtf-search-field').blur(function(){
                $('.edgtf-fullscreen-search-holder .edgtf-field-holder .edgtf-line').css("width","0");
            });

        }

    }

    /**
     * Function object that represents vertical menu area.
     * @returns {{init: Function}}
     */
    var edgtfVerticalMenu = function() {
        /**
         * Main vertical area object that used through out function
         * @type {jQuery object}
         */
        var verticalMenuObject = $('.edgtf-vertical-menu-area');

        /**
         * Initialzes navigation functionality. It checks navigation type data attribute and calls proper functions
         */
        var initNavigation = function() {
            var verticalNavObject = verticalMenuObject.find('.edgtf-vertical-menu');
            var navigationType = typeof verticalNavObject.data('navigation-type') !== 'undefined' ? verticalNavObject.data('navigation-type') : '';

            switch(navigationType) {
                //case 'dropdown-toggle':
                //    dropdownHoverToggle();
                //    break;
                //case 'dropdown-toggle-click':
                //    dropdownClickToggle();
                //    break;
                //case 'float':
                //    dropdownFloat();
                //    break;
                //case 'slide-in':
                //    dropdownSlideIn();
                //    break;
                default:
                    dropdownFloat();
                    break;
            }

            /**
             * Initializes floating navigation type (it comes from the side as a dropdown)
             */
            function dropdownFloat() {
                var menuItems = verticalNavObject.find('ul li.menu-item-has-children');
                var allDropdowns = menuItems.find(' > .second, > ul');

                menuItems.each(function() {
                    var elementToExpand = $(this).find(' > .second, > ul');
                    var menuItem = this;

                    if(Modernizr.touch) {
                        var dropdownOpener = $(this).find('> a');

                        dropdownOpener.on('click tap', function(e) {
                            e.preventDefault();
                            e.stopPropagation();

                            if(elementToExpand.hasClass('edgtf-float-open')) {
                                elementToExpand.removeClass('edgtf-float-open');
                                $(menuItem).removeClass('open');
                            } else {
                                if(!$(this).parents('li').hasClass('open')) {
                                    menuItems.removeClass('open');
                                    allDropdowns.removeClass('edgtf-float-open');
                                }

                                elementToExpand.addClass('edgtf-float-open');
                                $(menuItem).addClass('open');
                            }
                        });
                    } else {
                        //must use hoverIntent because basic hover effect doesn't catch dropdown
                        //it doesn't start from menu item's edge
                        $(this).hoverIntent({
                            over: function() {
                                elementToExpand.addClass('edgtf-float-open');
                                $(menuItem).addClass('open');
                            },
                            out: function() {
                                elementToExpand.removeClass('edgtf-float-open');
                                $(menuItem).removeClass('open');
                            },
                            timeout: 300
                        });
                    }
                });
            }

        };

        return {
            /**
             * Calls all necessary functionality for vertical menu area if vertical area object is valid
             */
            init: function() {
                if(verticalMenuObject.length) {
                    initNavigation();
                }
            }
        };
    };

})(jQuery);
(function($) {
    "use strict";

    var title = {};
    edgtf.modules.title = title;

    title.edgtfParallaxTitle = edgtfParallaxTitle;

    $(document).ready(function() {
        edgtfParallaxTitle();
    });

    $(window).on('load', function() {


    });

    $(window).resize(function() {

    });

    /*
     **	Title image with parallax effect
     */
    function edgtfParallaxTitle(){
        if($('.edgtf-title.edgtf-has-parallax-background').length > 0 && $('.touch').length === 0){

            var parallaxBackground = $('.edgtf-title.edgtf-has-parallax-background');
            var parallaxBackgroundWithZoomOut = $('.edgtf-title.edgtf-has-parallax-background.edgtf-zoom-out');

            var backgroundSizeWidth = parseInt(parallaxBackground.data('background-width').match(/\d+/));
            var titleHolderHeight = parallaxBackground.data('height');
            var titleRate = (titleHolderHeight / 10000) * 7;
            var titleYPos = -(edgtf.scroll * titleRate);

            //set position of background on doc ready
            parallaxBackground.css({'background-position': 'center '+ (titleYPos+edgtfQuadricGlobalVars.vars.edgtfAddForAdminBar) +'px' });
            parallaxBackgroundWithZoomOut.css({'background-size': backgroundSizeWidth-edgtf.scroll + 'px auto'});

            //set position of background on window scroll
            $(window).scroll(function() {
                titleYPos = -(edgtf.scroll * titleRate);
                parallaxBackground.css({'background-position': 'center ' + (titleYPos+edgtfQuadricGlobalVars.vars.edgtfAddForAdminBar) + 'px' });
                parallaxBackgroundWithZoomOut.css({'background-size': backgroundSizeWidth-edgtf.scroll + 'px auto'});
            });

        }
    }

})(jQuery);

(function($) {
    'use strict';

    var shortcodes = {};

    edgtf.modules.shortcodes = shortcodes;

    shortcodes.edgtfInitCounter = edgtfInitCounter;
    shortcodes.edgtfInitProgressBars = edgtfInitProgressBars;
    shortcodes.edgtfInitCountdown = edgtfInitCountdown;
    shortcodes.edgtfInitMessages = edgtfInitMessages;
    shortcodes.edgtfInitMessageHeight = edgtfInitMessageHeight;
    shortcodes.edgtfInitTestimonials = edgtfInitTestimonials;
    shortcodes.edgtfInitCarousels = edgtfInitCarousels;
    shortcodes.edgtfInitPieChart = edgtfInitPieChart;
    shortcodes.edgtfInitPieChartDoughnut = edgtfInitPieChartDoughnut;
    shortcodes.edgtfInitTabs = edgtfInitTabs;
    shortcodes.edgtfInitTabIcons = edgtfInitTabIcons;
    shortcodes.edgtfInitBlogListMasonry = edgtfInitBlogListMasonry;
    shortcodes.edgtfCustomFontResize = edgtfCustomFontResize;
    shortcodes.edgtfInitImageGallery = edgtfInitImageGallery;
    shortcodes.edgtfInitImageGalleryCarousel = edgtfInitImageGalleryCarousel;
    shortcodes.edgtfInitAccordions = edgtfInitAccordions;
    shortcodes.edgtfShowGoogleMap = edgtfShowGoogleMap;
    shortcodes.edgtfInitPortfolioListMasonry = edgtfInitPortfolioListMasonry;
    shortcodes.edgtfInitPortfolio = edgtfInitPortfolio;
    shortcodes.edgtfInitPortfolioMasonryFilter = edgtfInitPortfolioMasonryFilter;
    shortcodes.edgtfInitPortfolioSlider = edgtfInitPortfolioSlider;
    shortcodes.edgtfInitPortfolioLoadMore = edgtfInitPortfolioLoadMore;
    shortcodes.edgtfInitZigZagSeparator = edgtfInitZigZagSeparator;
    shortcodes.edgtfInitSvgIcons = edgtfInitSvgIcons;
    shortcodes.edgtfSetRevealingBackgrounds = edgtfSetRevealingBackgrounds;
    shortcodes.edgtfInitContentSlider = edgtfInitContentSlider;
    shortcodes.edgtfInitZoomingSlider = edgtfInitZoomingSlider;
    shortcodes.edgtfInitTeamSlider = edgtfInitTeamSlider;
	shortcodes.edgtfCheckSliderForHeaderStyle = edgtfCheckSliderForHeaderStyle;

    $(document).ready(function() {
        edgtfInitCounter();
        edgtfInitProgressBars();
        edgtfInitCountdown();
        edgtfIcon().init();
        edgtfIconSlider().init();
        edgtfInitMessages();
        edgtfInitMessageHeight();
        edgtfInitTestimonials();
        edgtfInitCarousels();
        edgtfInitPieChart();
        edgtfInitPieChartDoughnut();
		edgtfInitTabs();
        edgtfInitTabIcons();
        edgtfButton().init();
        edgtfInitBlogListMasonry();
		edgtfCustomFontResize();
        edgtfInitImageGallery();
        edgtfInitAccordions();
        edgtfShowGoogleMap();
        edgtfInitPortfolioListMasonry();
        edgtfInitPortfolio();
        edgtfInitPortfolioMasonryFilter();
        edgtfInitPortfolioSlider();
        edgtfInitPortfolioLoadMore();
        edgtfInitZigZagSeparator();
        edgtfSetRevealingBackgrounds();
        edgtfInitSvgIcons();
        edgtfInitContentSlider();
        edgtfInitTeamSlider();
        edgtfInitZoomingSlider();
        edgtfInitImageGalleryCarousel();
		edgtfSlider().init();
    });
    
    $(window).resize(function(){
        edgtfInitBlogListMasonry();
		edgtfCustomFontResize();     
    });

    /**
     * Counter Shortcode
     */
    function edgtfInitCounter() {

        var counters = $('.edgtf-counter');


        if (counters.length) {
            counters.each(function() {
                var counter = $(this);
                counter.appear(function() {
                    counter.parent().addClass('edgtf-counter-holder-show');

                    //Counter zero type
                    if (counter.hasClass('zero')) {
                        var max = parseFloat(counter.text());
                        counter.countTo({
                            from: 0,
                            to: max,
                            speed: 1500,
                            refreshInterval: 100
                        });
                    } else {
                        counter.absoluteCounter({
                            speed: 2000,
                            fadeInDelay: 1000
                        });
                    }

                },{accX: 0, accY: edgtfQuadricGlobalVars.vars.edgtfElementAppearAmount});
            });
        }

    }
    
        /*
    **	Horizontal progress bars shortcode
    */
    function edgtfInitProgressBars(){
        
        var progressBar = $('.edgtf-progress-bar');
        
        if(progressBar.length){
            
            progressBar.each(function() {
                
                var thisBar = $(this);
                
                thisBar.appear(function() {
                    edgtfInitToCounterProgressBar(thisBar);
                    if(thisBar.find('.edgtf-floating.edgtf-floating-inside') !== 0){
                        var floatingInsideMargin = thisBar.find('.edgtf-progress-content').height();
                        floatingInsideMargin += parseFloat(thisBar.find('.edgtf-progress-title-holder').css('padding-bottom'));
                        floatingInsideMargin += parseFloat(thisBar.find('.edgtf-progress-title-holder').css('margin-bottom'));
                        thisBar.find('.edgtf-floating-inside').css('margin-bottom',-(floatingInsideMargin)+'px');
                    }
                    var percentage = thisBar.find('.edgtf-progress-content').data('percentage'),
                        progressContent = thisBar.find('.edgtf-progress-content'),
                        progressNumber = thisBar.find('.edgtf-progress-number');

                    progressContent.css('width', '0%');
                    progressContent.animate({'width': percentage+'%'}, 1500);
                    progressNumber.css('left', '0%');
                    progressNumber.animate({'left': percentage+'%'}, 1500);

                });
            });
        }
    }
    /*
    **	Counter for horizontal progress bars percent from zero to defined percent
    */
    function edgtfInitToCounterProgressBar(progressBar){
        var percentage = parseFloat(progressBar.find('.edgtf-progress-content').data('percentage'));
        var percent = progressBar.find('.edgtf-progress-number .edgtf-percent');
        if(percent.length) {
            percent.each(function() {
                var thisPercent = $(this);
                thisPercent.parents('.edgtf-progress-number-wrapper').css('opacity', '1');
                thisPercent.countTo({
                    from: 0,
                    to: percentage,
                    speed: 1500,
                    refreshInterval: 50
                });
            });
        }
    }
    
    /*
    **	Function to close message shortcode
    */
    function edgtfInitMessages(){
        var message = $('.edgtf-message');
        if(message.length){
            message.each(function(){
                var thisMessage = $(this);
                thisMessage.find('.edgtf-close').on('click', function(e){
                    e.preventDefault();
                    $(this).parent().parent().fadeOut(500);
                });
            });
        }
    }
    
    /*
    **	Init message height
    */
   function edgtfInitMessageHeight(){
       var message = $('.edgtf-message.edgtf-with-icon');
       if(message.length){
           message.each(function(){
               var thisMessage = $(this);
               var textHolderHeight = thisMessage.find('.edgtf-message-text-holder').height();
               var iconHolderHeight = thisMessage.find('.edgtf-message-icon-holder').height();
               
               if(textHolderHeight > iconHolderHeight) {
                   thisMessage.find('.edgtf-message-icon-holder').height(textHolderHeight);
               } else {
                   thisMessage.find('.edgtf-message-text-holder').height(iconHolderHeight);
               }
           });
       }
   }

    /**
     * Countdown Shortcode
     */
    function edgtfInitCountdown() {

        var countdowns = $('.edgtf-countdown'),
            year,
            month,
            day,
            hour,
            minute,
            timezone,
            monthLabel,
            dayLabel,
            hourLabel,
            minuteLabel,
            secondLabel;

        if (countdowns.length) {

            countdowns.each(function(){

                //Find countdown elements by id-s
                var countdownId = $(this).attr('id'),
                    countdown = $('#'+countdownId),
                    digitFontSize,
                    labelFontSize;

                //Get data for countdown
                year = countdown.data('year');
                month = countdown.data('month');
                day = countdown.data('day');
                hour = countdown.data('hour');
                minute = countdown.data('minute');
                timezone = countdown.data('timezone');
                monthLabel = countdown.data('month-label');
                dayLabel = countdown.data('day-label');
                hourLabel = countdown.data('hour-label');
                minuteLabel = countdown.data('minute-label');
                secondLabel = countdown.data('second-label');
                digitFontSize = countdown.data('digit-size');
                labelFontSize = countdown.data('label-size');


                //Initialize countdown
                countdown.countdown({
                    until: new Date(year, month - 1, day, hour, minute, 44),
                    labels: ['Years', monthLabel, 'Weeks', dayLabel, hourLabel, minuteLabel, secondLabel],
                    format: 'ODHMS',
                    timezone: timezone,
                    padZeroes: true,
                    onTick: setCountdownStyle
                });

                function setCountdownStyle() {
                    countdown.find('.countdown-amount').css({
                        'font-size' : digitFontSize+'px',
                        'line-height' : digitFontSize+'px'
                    });
                    countdown.find('.countdown-period').css({
                        'font-size' : labelFontSize+'px'
                    });
                }

            });

        }

    }

    /**
     * Object that represents icon shortcode
     * @returns {{init: Function}} function that initializes icon's functionality
     */
    var edgtfIcon = edgtf.modules.shortcodes.edgtfIcon = function() {
        //get all icons on page
        var icons = $('.edgtf-icon-shortcode');

        /**
         * Function that triggers icon animation and icon animation delay
         */
        var iconAnimation = function(icon) {
            if(icon.hasClass('edgtf-icon-animation')) {
                icon.appear(function() {
                    icon.parent('.edgtf-icon-animation-holder').addClass('edgtf-icon-animation-show');
                }, {accX: 0, accY: edgtfQuadricGlobalVars.vars.edgtfElementAppearAmount});
            }
        };

        /**
         * Function that triggers icon hover color functionality
         */
        var iconHoverColor = function(icon) {
            if(typeof icon.data('hover-color') !== 'undefined') {
                var changeIconColor = function(event) {
                    event.data.icon.css('color', event.data.color);
                };

                var iconElement = icon.find('.edgtf-icon-element');
                var hoverColor = icon.data('hover-color');
                var originalColor = iconElement.css('color');

                if(hoverColor !== '') {
                    icon.on('mouseenter', {icon: iconElement, color: hoverColor}, changeIconColor);
                    icon.on('mouseleave', {icon: iconElement, color: originalColor}, changeIconColor);
                }
            }
        };

        /**
         * Function that triggers icon holder background color hover functionality
         */
        var iconHolderBackgroundHover = function(icon) {
            if(typeof icon.data('hover-background-color') !== 'undefined') {
                var changeIconBgColor = function(event) {
                    event.data.icon.css('background-color', event.data.color);
                };

                var hoverBackgroundColor = icon.data('hover-background-color');
                var originalBackgroundColor = icon.css('background-color');

                if(hoverBackgroundColor !== '') {
                    icon.on('mouseenter', {icon: icon, color: hoverBackgroundColor}, changeIconBgColor);
                    icon.on('mouseleave', {icon: icon, color: originalBackgroundColor}, changeIconBgColor);
                }
            }
        };

        /**
         * Function that initializes icon holder border hover functionality
         */
        var iconHolderBorderHover = function(icon) {
            if(typeof icon.data('hover-border-color') !== 'undefined') {
                var changeIconBorder = function(event) {
                    event.data.icon.css('border-color', event.data.color);
                };

                var hoverBorderColor = icon.data('hover-border-color');
                var originalBorderColor = icon.css('border-color');

                if(hoverBorderColor !== '') {
                    icon.on('mouseenter', {icon: icon, color: hoverBorderColor}, changeIconBorder);
                    icon.on('mouseleave', {icon: icon, color: originalBorderColor}, changeIconBorder);
                }
            }
        };

        return {
            init: function() {
                if(icons.length) {
                    icons.each(function() {
                        iconAnimation($(this));
                        iconHoverColor($(this));
                        iconHolderBackgroundHover($(this));
                        iconHolderBorderHover($(this));
                    });

                }
            }
        };
    };

    /**
     * Init testimonials shortcode
     */
    function edgtfInitTestimonials(){

        var testimonial = $('.edgtf-testimonials');
        if(testimonial.length){
            testimonial.each(function(){

                var thisTestimonial = $(this);

                thisTestimonial.appear(function() {
                    thisTestimonial.css('visibility','visible');
                },{accX: 0, accY: edgtfQuadricGlobalVars.vars.edgtfElementAppearAmount});

                var interval = 5000;
                var controlNav = true;
                var directionNav = false;
                var animationSpeed = 600;
                if(typeof thisTestimonial.data('animation-speed') !== 'undefined' && thisTestimonial.data('animation-speed') !== false) {
                    interval = thisTestimonial.data('animation-speed');
                }

                thisTestimonial.owlCarousel({
                    items: 1,
                    loop:true,
                    autoplay: true,
                    autoplayTimeout: interval,
                    navigation: directionNav,
                    //transitionStyle : 'fade', //fade, fadeUp, backSlide, goDown
                    animateIn:'fadeIn',
                    animateOut:'fadeOut',
                    autoHeight: true,
                    pagination: controlNav,
                    autoplaySpeed: animationSpeed,
                });

            });

        }

    }

    /**
     * Init Carousel shortcode
     */
    function edgtfInitCarousels() {

        var carouselHolders = $('.edgtf-carousel-holder'),
            carousel,
            numberOfItems,
            navigation,
            bulletsNavigation;

        if (carouselHolders.length) {
            carouselHolders.each(function(){
                carousel = carouselHolders.children('.edgtf-carousel');
                numberOfItems = carousel.data('items');
                navigation = (carousel.data('navigation') == 'yes') ? true : false;
                bulletsNavigation = (carousel.data('bullets-navigation') == 'yes') ? true : false;
				console.log(bulletsNavigation);

                carousel.owlCarousel({
                    loop:true,
                    autoplay: true,
                    autoplayTimeout: 3000,
                    items: numberOfItems,
                    responsiveClass:true,
                    responsive:{
                        0:{
                            items:1,
                        },
                        480:{
                            items:2,
                        },
                        768:{
                            items:3,
                        },
                        1024:{
                            items:numberOfItems,
                        }
                    },
                    dots: bulletsNavigation,
                    nav: navigation,
                    autoplaySpeed: 600,
                    navText: [
                        '<span class="edgtf-prev-icon"><i class="icon-arrows-left"></i></span>',
                        '<span class="edgtf-next-icon"><i class="icon-arrows-right"></i></span>'
                    ]
                });

            });
        }

    }

    /**
     * Init Pie Chart and Pie Chart With Icon shortcode
     */
    function edgtfInitPieChart() {

        var pieCharts = $('.edgtf-pie-chart-holder, .edgtf-pie-chart-with-icon-holder');

        if (pieCharts.length) {

            pieCharts.each(function () {               

                var pieChart = $(this),
                    percentageHolder = pieChart.children('.edgtf-percentage, .edgtf-percentage-with-icon'),
                    barColor,
                    trackColor,
                    lineWidth,
                    size = 145;
                    
                percentageHolder.appear(function() {
                    initToCounterPieChart(pieChart);
                    percentageHolder.css('opacity', '1');                    
                    percentageHolder.easyPieChart({
                        barColor: barColor,
                        trackColor: trackColor,
                        scaleColor: false,
                        lineCap: 'butt',
                        lineWidth: lineWidth,
                        animate: 1500,
                        size: size
                    });
                },{accX: 0, accY: edgtfQuadricGlobalVars.vars.edgtfElementAppearAmount});

            });

        }

    }

    /*
     **	Counter for pie chart number from zero to defined number
     */
    function initToCounterPieChart( pieChart ){

        pieChart.css('opacity', '1');
        var counter = pieChart.find('.edgtf-to-counter'),
            max = parseFloat(counter.text());
        counter.countTo({
            from: 0,
            to: max,
            speed: 1500,
            refreshInterval: 50
        });

    }

    /**
     * Init Pie Chart shortcode
     */
    function edgtfInitPieChartDoughnut() {

        var pieCharts = $('.edgtf-pie-chart-doughnut-holder, .edgtf-pie-chart-pie-holder');

        pieCharts.each(function(){

            var pieChart = $(this),
                canvas = pieChart.find('canvas'),
                chartID = canvas.attr('id'),
                chart = document.getElementById(chartID).getContext('2d'),
                data = [],
                jqChart = $(chart.canvas); //Convert canvas to JQuery object and get data parameters

            for (var i = 1; i<=10; i++) {

                var chartItem,
                    value = jqChart.data('value-' + i),
                    color = jqChart.data('color-' + i);
                
                if (typeof value !== 'undefined' && typeof color !== 'undefined' ) {
                    chartItem = {
                        value : value,
                        color : color
                    };
                    data.push(chartItem);
                }

            }

            if (canvas.hasClass('edgtf-pie')) {
                new Chart(chart).Pie(data,
                    {segmentStrokeColor : 'transparent'}
                );
            } else {
                new Chart(chart).Doughnut(data,
                    {segmentStrokeColor : 'transparent'}
                );
            }

        });

    }

    /*
    **	Init tabs shortcode
    */
    function edgtfInitTabs(){

       var tabs = $('.edgtf-tabs');
        if(tabs.length){
            tabs.each(function(){
                var thisTabs = $(this);

                if(thisTabs.hasClass('edgtf-horizontal')){
                    thisTabs.tabs();
                }
                else if(thisTabs.hasClass('edgtf-vertical')){
                    thisTabs.tabs().addClass( 'ui-tabs-vertical ui-helper-clearfix' );
                    thisTabs.find('.edgtf-tabs-nav > ul >li').removeClass( 'ui-corner-top' ).addClass( 'ui-corner-left' );
                }
            });
        }
    }

    /*
    **	Generate icons in tabs navigation
    */
    function edgtfInitTabIcons(){

        var tabContent = $('.edgtf-tab-container');
        if(tabContent.length){

            tabContent.each(function(){
                var thisTabContent = $(this);

                var id = thisTabContent.attr('id');
                var icon = '';
                if(typeof thisTabContent.data('icon-html') !== 'undefined' || thisTabContent.data('icon-html') !== 'false') {
                    icon = thisTabContent.data('icon-html');
                }

                var tabNav = thisTabContent.parents('.edgtf-tabs').find('.edgtf-tabs-nav > li > a[href="#'+id+'"]');

                if(typeof(tabNav) !== 'undefined') {
                    tabNav.children('.edgtf-icon-frame').append(icon);
                }
            });
        }
    }

    /**
     * Button object that initializes whole button functionality
     * @type {Function}
     */
    var edgtfButton = edgtf.modules.shortcodes.edgtfButton = function() {
        //all buttons on the page
        var buttons = $('.edgtf-btn');

        /**
         * Initializes button hover color
         * @param button current button
         */
        var buttonHoverColor = function(button) {
            if(typeof button.data('hover-color') !== 'undefined') {
                var changeButtonColor = function(event) {
                    event.data.button.css('color', event.data.color);
                };

                var originalColor = button.css('color');
                var hoverColor = button.data('hover-color');

                button.on('mouseenter', { button: button, color: hoverColor }, changeButtonColor);
                button.on('mouseleave', { button: button, color: originalColor }, changeButtonColor);
            }
        };



        /**
         * Initializes button hover background color
         * @param button current button
         */
        var buttonHoverBgColor = function(button) {
            if(typeof button.data('hover-bg-color') !== 'undefined') {
                var changeButtonBg = function(event) {
                    event.data.button.css('background-color', event.data.color);
                };

                var originalBgColor = button.css('background-color');
                var hoverBgColor = button.data('hover-bg-color');

                button.on('mouseenter', { button: button, color: hoverBgColor }, changeButtonBg);
                button.on('mouseleave', { button: button, color: originalBgColor }, changeButtonBg);
            }
        };

        /**
         * Initializes button border color
         * @param button
         */
        var buttonHoverBorderColor = function(button) {
            if(typeof button.data('hover-border-color') !== 'undefined') {
                var changeBorderColor = function(event) {
                    event.data.button.css('border-color', event.data.color);
                };

                var originalBorderColor = button.css('borderTopColor');
                var hoverBorderColor = button.data('hover-border-color');

                button.on('mouseenter', { button: button, color: hoverBorderColor }, changeBorderColor);
                button.on('mouseleave', { button: button, color: originalBorderColor }, changeBorderColor);
            }

            if(typeof button.data('text-hover-border-color') !== 'undefined') {
                var changeTextBorderColor = function(event) {
                     event.data.button.find('.edgtf-btn-text').css('border-color', event.data.color);
                };

                var originalTextBorderColor = button.find('.edgtf-btn-text').css('border-color');
                var hoverTextBorderColor = button.data('text-hover-border-color');

                button.on('mouseenter', { button: button, color: hoverTextBorderColor }, changeTextBorderColor);
                button.on('mouseleave', { button: button, color: originalTextBorderColor }, changeTextBorderColor);
            }
        };

        return {
            init: function() {
                if(buttons.length) {
                    buttons.each(function() {
                        buttonHoverColor($(this));
                        buttonHoverBgColor($(this));
                        buttonHoverBorderColor($(this));
                    });
                }
            }
        };
    };
    
    /*
    **	Init blog list masonry type
    */
    function edgtfInitBlogListMasonry(){
        var blogList = $('.edgtf-blog-list-holder.edgtf-masonry .edgtf-blog-list');
        if(blogList.length) {
            blogList.each(function() {
                var thisBlogList = $(this);
                thisBlogList.animate({opacity: 1});
                thisBlogList.isotope({
                    itemSelector: '.edgtf-blog-list-masonry-item',
                    masonry: {
                        columnWidth: '.edgtf-blog-list-masonry-grid-sizer',
                        gutter: '.edgtf-blog-list-masonry-grid-gutter'
                    }
                });
            });

        }
    }

	/*
	**	Custom Font resizing
	*/
	function edgtfCustomFontResize(){
		var customFont = $('.edgtf-custom-font-holder');
		if (customFont.length){
			customFont.each(function(){
				var thisCustomFont = $(this);
				var fontSize;
				var lineHeight;
				var coef1 = 1;
				var coef2 = 1;

				if (edgtf.windowWidth < 1200){
					coef1 = 0.8;
				}

				if (edgtf.windowWidth < 1000){
					coef1 = 0.7;
				}

				if (edgtf.windowWidth < 768){
					coef1 = 0.6;
					coef2 = 0.7;
				}

				if (edgtf.windowWidth < 600){
					coef1 = 0.5;
					coef2 = 0.6;
				}

				if (edgtf.windowWidth < 480){
					coef1 = 0.4;
					coef2 = 0.5;
				}

				if (typeof thisCustomFont.data('font-size') !== 'undefined' && thisCustomFont.data('font-size') !== false) {
					fontSize = parseInt(thisCustomFont.data('font-size'));

					if (fontSize > 70) {
						fontSize = Math.round(fontSize*coef1);
					}
					else if (fontSize > 35) {
						fontSize = Math.round(fontSize*coef2);
					}

					thisCustomFont.css('font-size',fontSize + 'px');
				}

				if (typeof thisCustomFont.data('line-height') !== 'undefined' && thisCustomFont.data('line-height') !== false) {
					lineHeight = parseInt(thisCustomFont.data('font-size'));

					if (lineHeight > 70 && edgtf.windowWidth < 1200) {
						lineHeight = '1.2em';
					}
					else if (lineHeight > 35 && edgtf.windowWidth < 768) {
						lineHeight = '1.2em';
					}
					else{
						lineHeight += 'px';
					}

					thisCustomFont.css('line-height', lineHeight);
				}
			});
		}
	}

    /*
     **	Show Google Map
     */
    function edgtfShowGoogleMap(){

        if($('.edgtf-google-map').length){
            $('.edgtf-google-map').each(function(){

                var element = $(this);

                var customMapStyle;
                if(typeof element.data('custom-map-style') !== 'undefined') {
                    customMapStyle = element.data('custom-map-style');
                }

                var colorOverlay;
                if(typeof element.data('color-overlay') !== 'undefined' && element.data('color-overlay') !== false) {
                    colorOverlay = element.data('color-overlay');
                }

                var saturation;
                if(typeof element.data('saturation') !== 'undefined' && element.data('saturation') !== false) {
                    saturation = element.data('saturation');
                }

                var lightness;
                if(typeof element.data('lightness') !== 'undefined' && element.data('lightness') !== false) {
                    lightness = element.data('lightness');
                }

                var zoom;
                if(typeof element.data('zoom') !== 'undefined' && element.data('zoom') !== false) {
                    zoom = element.data('zoom');
                }

                var pin;
                if(typeof element.data('pin') !== 'undefined' && element.data('pin') !== false) {
                    pin = element.data('pin');
                }

                var mapHeight;
                if(typeof element.data('height') !== 'undefined' && element.data('height') !== false) {
                    mapHeight = element.data('height');
                }

                var uniqueId;
                if(typeof element.data('unique-id') !== 'undefined' && element.data('unique-id') !== false) {
                    uniqueId = element.data('unique-id');
                }

                var scrollWheel;
                if(typeof element.data('scroll-wheel') !== 'undefined') {
                    scrollWheel = element.data('scroll-wheel');
                }
                var addresses;
                if(typeof element.data('addresses') !== 'undefined' && element.data('addresses') !== false) {
                    addresses = element.data('addresses');
                }

                var map = "map_"+ uniqueId;
                var geocoder = "geocoder_"+ uniqueId;
                var holderId = "edgtf-map-"+ uniqueId;

                edgtfInitializeGoogleMap(customMapStyle, colorOverlay, saturation, lightness, scrollWheel, zoom, holderId, mapHeight, pin,  map, geocoder, addresses);
            });
        }

    }
    /*
     **	Init Google Map
     */
    function edgtfInitializeGoogleMap(customMapStyle, color, saturation, lightness, wheel, zoom, holderId, height, pin,  map, geocoder, data){
	
	    if (typeof google !== 'object') {
		    return;
	    }

        var mapStyles = [
            {
                stylers: [
                    {hue: color },
                    {saturation: saturation},
                    {lightness: lightness},
                    {gamma: 1}
                ]
            }
        ];

        var googleMapStyleId;

        if(customMapStyle){
            googleMapStyleId = 'edgtf-style';
        } else {
            googleMapStyleId = google.maps.MapTypeId.ROADMAP;
        }

        var qoogleMapType = new google.maps.StyledMapType(mapStyles,
            {name: "Edge Google Map"});

        geocoder = new google.maps.Geocoder();
        var latlng = new google.maps.LatLng(-34.397, 150.644);

        if (!isNaN(height)){
            height = height + 'px';
        }

        var myOptions = {

            zoom: zoom,
            scrollwheel: wheel,
            center: latlng,
            zoomControl: true,
            zoomControlOptions: {
                style: google.maps.ZoomControlStyle.SMALL,
                position: google.maps.ControlPosition.RIGHT_CENTER
            },
            scaleControl: false,
            scaleControlOptions: {
                position: google.maps.ControlPosition.LEFT_CENTER
            },
            streetViewControl: false,
            streetViewControlOptions: {
                position: google.maps.ControlPosition.LEFT_CENTER
            },
            panControl: false,
            panControlOptions: {
                position: google.maps.ControlPosition.LEFT_CENTER
            },
            mapTypeControl: false,
            mapTypeControlOptions: {
                mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'edgtf-style'],
                style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
                position: google.maps.ControlPosition.LEFT_CENTER
            },
            mapTypeId: googleMapStyleId
        };

        map = new google.maps.Map(document.getElementById(holderId), myOptions);
        map.mapTypes.set('edgtf-style', qoogleMapType);

        var index;

        for (index = 0; index < data.length; ++index) {
            edgtfInitializeGoogleAddress(data[index], pin, map, geocoder);
        }

        var holderElement = document.getElementById(holderId);
        holderElement.style.height = height;
    }
    /*
     **	Init Google Map Addresses
     */
    function edgtfInitializeGoogleAddress(data, pin,  map, geocoder){
        if (data === '')
            return;
        var contentString = '<div id="content">'+
            '<div id="siteNotice">'+
            '</div>'+
            '<div id="bodyContent">'+
            '<p>'+data+'</p>'+
            '</div>'+
            '</div>';
        var infowindow = new google.maps.InfoWindow({
            content: contentString
        });
        geocoder.geocode( { 'address': data}, function(results, status) {
            if (status === google.maps.GeocoderStatus.OK) {
                map.setCenter(results[0].geometry.location);
                var marker = new google.maps.Marker({
                    map: map,
                    position: results[0].geometry.location,
                    icon:  pin,
                    title: data['store_title']
                });
                google.maps.event.addListener(marker, 'click', function() {
                    infowindow.open(map,marker);
                });

                google.maps.event.addDomListener(window, 'resize', function() {
                    map.setCenter(results[0].geometry.location);
                });

            }
        });
    }

    function edgtfInitAccordions(){
        var accordion = $('.edgtf-accordion-holder');
        if(accordion.length){
            accordion.each(function(){

               var thisAccordion = $(this);

				if(thisAccordion.hasClass('edgtf-accordion')){

					thisAccordion.accordion({
						animate: "swing",
						collapsible: true,
						active: 0,
						icons: "",
						heightStyle: "content"
					});
				}

				if(thisAccordion.hasClass('edgtf-toggle')){

					var toggleAccordion = $(this);
					var toggleAccordionTitle = toggleAccordion.find('.edgtf-title-holder');
					var toggleAccordionContent = toggleAccordionTitle.next();

					toggleAccordion.addClass("accordion ui-accordion ui-accordion-icons ui-widget ui-helper-reset");
					toggleAccordionTitle.addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-top ui-corner-bottom");
					toggleAccordionContent.addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom").hide();

					toggleAccordionTitle.each(function(){
						var thisTitle = $(this);
						thisTitle.on('mouseenter mouseleave', function () {
							thisTitle.toggleClass("ui-state-hover");
						});

						thisTitle.on('click',function(){
							thisTitle.toggleClass('ui-accordion-header-active ui-state-active ui-state-default ui-corner-bottom');
							thisTitle.next().toggleClass('ui-accordion-content-active').slideToggle(400);
						});
					});
				}
            });
        }
    }

    function edgtfInitImageGallery() {

        var galleries = $('.edgtf-image-gallery');

        if (galleries.length) {
            galleries.each(function () {
                var gallery = $(this).children('.edgtf-image-gallery-slider'),
                    autoplay = gallery.data('autoplay'),
                    animation = (gallery.data('animation') == 'slide') ? false : gallery.data('animation'),
                    navigation = (gallery.data('navigation') == 'yes'),
                    animationIn = false,
                    animationOut = false,
                    pagination = (gallery.data('pagination') == 'yes');


                if(animation){
                    animationIn = animation.concat('In');
                    animationOut = animation.concat('Out');
                }

                gallery.owlCarousel({
                    items: 1,
                    loop:true,
                    autoplay: true,
                    autoplayTimeout:autoplay * 1000,
                    nav: navigation,
                    animateOut: animationOut,
                    animateIn: animationIn,
                    autoHeight: true,
                    dots: pagination,
                    smartSpeed: 1000,
                    navText: [
                        '<span class="edgtf-prev-icon"><i class="icon-arrows-left"></i></span>',
                        '<span class="edgtf-next-icon"><i class="icon-arrows-right"></i></span>'
                    ]
                });
            });
        }

    }

    function edgtfInitImageGalleryCarousel() {

        var galleries = $('.edgtf-image-gallery.carousel');

        if (galleries.length) {
            galleries.each(function () {
                var gallery = $(this).children('.edgtf-image-gallery-carousel'),
                    autoplay = gallery.data('autoplay'),                    
                    navigation = (gallery.data('navigation') == 'yes'),
                    pagination = (gallery.data('pagination') == 'yes');            

                gallery.owlCarousel({
                    items: 1,
                    loop:true,
                    autoplay: true,
                    autoplayTimeout:autoplay * 1000,
                    nav: false,
                    autoHeight: true,
                    dots: pagination,
                    smartSpeed: 600,                   
                });

                var navPrev = $(this).parent().find('.edgtf-image-gallery-nav span.edgtf-prev-icon');
                var navNext = $(this).parent().find('.edgtf-image-gallery-nav span.edgtf-next-icon');
                navPrev.on('click', function() {
                    gallery.trigger('prev.owl.carousel', [600]);
                });
                navNext.on('click', function() {
                    gallery.trigger('next.owl.carousel', [600]);
                });
            });
        }

    }

    /**
     * Initializes portfolio list
     */
    function edgtfInitPortfolio(){
        var portList = $('.edgtf-portfolio-list-holder-outer');
        if(portList.length){
            portList.each(function(){
                var thisPortList = $(this);
                if((thisPortList.hasClass('edgtf-ptf-standard') || thisPortList.hasClass('edgtf-ptf-gallery') || thisPortList.hasClass('edgtf-ptf-gallery-with-space')) && !thisPortList.hasClass('edgtf-portfolio-slider-holder')){
                    thisPortList.appear(function(){
                        edgtfInitPortMixItUp(thisPortList);
                    });
                }    
            });
        }
    }
    /**
     * Initializes mixItUp function for specific container
     */
    function edgtfInitPortMixItUp(container){
        var filterClass = '';
        if(container)
        if(container.hasClass('edgtf-ptf-has-filter')){
            filterClass = container.find('.edgtf-portfolio-filter-holder-inner ul li').data('class');
            filterClass = '.'+filterClass;
        }
        
        var holderInner = container.find('.edgtf-portfolio-list-holder');
        holderInner.mixItUp({
            callbacks: {
                onMixLoad: function(){
                    holderInner.find('article').css('visibility','visible');
                },
                onMixStart: function(){
                    holderInner.find('article').css('visibility','visible');
                },
                onMixBusy: function(){
                    holderInner.find('article').css('visibility','visible');
                } 
            },           
            selectors: {
                filter: filterClass
            },
            animation: {
                effects: 'fade',
                duration: 500
            }
            
        });
        
    }
     /*
    **	Init portfolio list masonry type
    */
    function edgtfInitPortfolioListMasonry(){
        var portList = $('.edgtf-portfolio-list-holder-outer');
        if(portList.length && (portList)){
            portList.each(function() {
                var thisPortList = $(this);                
                if(thisPortList.hasClass('edgtf-ptf-masonry') || thisPortList.hasClass('edgtf-ptf-masonry-with-space')){
                    var thisPortListInner = thisPortList.find('.edgtf-portfolio-list-holder');
                    var size = thisPortList.find('.edgtf-portfolio-list-masonry-grid-sizer').width();
                    edgtfResizeMasonry(size,thisPortListInner);                    
                    edgtfInitMasonry(thisPortListInner);
                    $(window).resize(function(){
                        size = thisPortList.find('.edgtf-portfolio-list-masonry-grid-sizer').width();
                        edgtfResizeMasonry(size,thisPortListInner);
                        edgtfInitMasonry(thisPortListInner);
                    });
                }
            });
        }
    }

    function edgtfInitMasonry(container){
        
        container.isotope({
            itemSelector: '.edgtf-portfolio-item',
            masonry: {
                columnWidth: '.edgtf-portfolio-list-masonry-grid-sizer',
                gutter: '.edgtf-portfolio-list-masonry-grid-gutter'
            }
        });
        container.animate({opacity: 1});
    }
    
    function edgtfResizeMasonry(size,container){
        
        var defaultMasonryItem = container.find('.edgtf-default-masonry-item');
        var largeWidthMasonryItem = container.find('.edgtf-large-width-masonry-item');
        var largeHeightMasonryItem = container.find('.edgtf-large-height-masonry-item');
        var largeWidthHeightMasonryItem = container.find('.edgtf-large-width-height-masonry-item');

        defaultMasonryItem.css('height', size);
        largeWidthMasonryItem.css('height', size);
        largeWidthHeightMasonryItem.css('height', Math.round(2*size));
        largeHeightMasonryItem.css('height', Math.round(2*size));
        
        if(edgtf.windowWidth < 600){
            largeWidthMasonryItem.css('height',Math.round(size/2));
            largeWidthHeightMasonryItem.css('height', size);
        }
    }

    /**
     * Initializes portfolio masonry filter
     */
    function edgtfInitPortfolioMasonryFilter(){
        
        var filterHolder = $('.edgtf-portfolio-filter-holder.edgtf-masonry-filter');
        
        if(filterHolder.length){
            filterHolder.each(function(){
               
                var thisFilterHolder = $(this);
                
                var portfolioIsotopeAnimation = null;
                
                var filter = thisFilterHolder.find('ul li').data('class');
                
                thisFilterHolder.find('.filter:first').addClass('current');
                
                thisFilterHolder.find('.filter').on('click', function(){

                    var currentFilter = $(this);
                    clearTimeout(portfolioIsotopeAnimation);

                    $('.isotope, .isotope .isotope-item').css('transition-duration','0.8s');

                    portfolioIsotopeAnimation = setTimeout(function(){
                        $('.isotope, .isotope .isotope-item').css('transition-duration','0s'); 
                    },700);

                    var selector = $(this).attr('data-filter');
                    thisFilterHolder.siblings('.edgtf-portfolio-list-holder-outer').find('.edgtf-portfolio-list-holder').isotope({ filter: selector });

                    thisFilterHolder.find('.filter').removeClass('current');
                    currentFilter.addClass('current');

                    return false;

                });
                
            });
        }
    }
    /**
     * Initializes portfolio slider
     */
    
    function edgtfInitPortfolioSlider(){
        var portSlider = $('.edgtf-portfolio-list-holder-outer.edgtf-portfolio-slider-holder');
        if(portSlider.length){
            portSlider.each(function(){
                var thisPortSlider = $(this);
                var sliderWrapper = thisPortSlider.children('.edgtf-portfolio-list-holder');
                var numberOfItems = thisPortSlider.data('items');
                var navigation = false;              

                sliderWrapper.owlCarousel({
                    loop:true,
                    responsiveClass:true,
                    responsive:{
                        0:{
                            items:1,
                        },
                        480:{
                            items:2,
                        },
                        768:{
                            items:3,
                        },
                        1024:{
                            items:numberOfItems,
                        }
                    },
                    autoplay:false,              
                    items: numberOfItems,
                    dots: true,
                    nav: navigation,
                    smartSpeed: 600,                    
                    animateOut:'fadeOut',
                    animateIn:'fadeIn',
                    navText: [
                        '<span class="edgtf-prev-icon"><i class="icon-arrows-left"></i></span>',
                        '<span class="edgtf-next-icon"><i class="icon-arrows-right"></i></span>'
                    ]
                });
            });
        }
    }
    /**
     * Initializes portfolio load more function
     */
    function edgtfInitPortfolioLoadMore(){
        var portList = $('.edgtf-portfolio-list-holder-outer.edgtf-ptf-load-more');
        if(portList.length){
            portList.each(function(){
                
                var thisPortList = $(this);
                var thisPortListInner = thisPortList.find('.edgtf-portfolio-list-holder');
                var nextPage; 
                var maxNumPages;
                var loadMoreButton = thisPortList.find('.edgtf-ptf-list-load-more a');
                
                if (typeof thisPortList.data('max-num-pages') !== 'undefined' && thisPortList.data('max-num-pages') !== false) {  
                    maxNumPages = thisPortList.data('max-num-pages');
                }
                
                loadMoreButton.on('click', function (e) {  
                    var loadMoreDatta = edgtfGetPortfolioAjaxData(thisPortList);
                    nextPage = loadMoreDatta.nextPage;
                    e.preventDefault();
                    e.stopPropagation(); 
                    if(nextPage <= maxNumPages){
                        var ajaxData = edgtfSetPortfolioAjaxData(loadMoreDatta);
                        $.ajax({
                            type: 'POST',
                            data: ajaxData,
                            url: edgtCoreAjaxUrl,
                            success: function (data) {
                                nextPage++;
                                thisPortList.data('next-page', nextPage);
                                var response = $.parseJSON(data);
                                var responseHtml = edgtfConvertHTML(response.html); //convert response html into jQuery collection that Mixitup can work with
                                thisPortList.waitForImages(function(){    
                                    setTimeout(function() {                                        
                                        if(thisPortList.hasClass('edgtf-ptf-masonry') || thisPortList.hasClass('edgtf-ptf-masonry-with-space')){
                                            var size = thisPortList.find('.edgtf-portfolio-list-masonry-grid-sizer').width();                                                     
                                            thisPortListInner.append( responseHtml ).isotope( 'appended', responseHtml ).isotope('layout');
                                            edgtfResizeMasonry(size,thisPortListInner);
                                            edgtfInitMasonry(thisPortListInner);
                                        }else{
                                            thisPortListInner.mixItUp('append',responseHtml);    
                                        }
                                    },400);                                    
                                });                           
                            }
                        });
                    }
                    if(nextPage === maxNumPages){
                        loadMoreButton.hide();
                    }
                });
                
            });
        }
    }
    
    function edgtfConvertHTML ( html ) {
        var newHtml = $.trim( html ),
                $html = $(newHtml ),
                $empty = $();

        $html.each(function ( index, value ) {
            if ( value.nodeType === 1) {
                $empty = $empty.add ( this );
            }
        });

        return $empty;
    };
    /**
     * Initializes portfolio load more data params
     * @param portfolio list container with defined data params
     * return array
     */
    function edgtfGetPortfolioAjaxData(container){
        var returnValue = {};
        
        returnValue.type = '';
        returnValue.columns = '';
        returnValue.gridSize = '';
        returnValue.orderBy = '';
        returnValue.order = '';
        returnValue.number = '';
        returnValue.imageSize = '';
        returnValue.filter = '';
        returnValue.filterOrderBy = '';
        returnValue.category = '';
        returnValue.selectedProjectes = '';
        returnValue.showLoadMore = '';
        returnValue.titleTag = '';
        returnValue.nextPage = '';
        returnValue.maxNumPages = '';
        
        if (typeof container.data('type') !== 'undefined' && container.data('type') !== false) {
            returnValue.type = container.data('type');
        }
        if (typeof container.data('grid-size') !== 'undefined' && container.data('grid-size') !== false) {                    
            returnValue.gridSize = container.data('grid-size');
        }
        if (typeof container.data('columns') !== 'undefined' && container.data('columns') !== false) {                    
            returnValue.columns = container.data('columns');
        }
        if (typeof container.data('order-by') !== 'undefined' && container.data('order-by') !== false) {                    
            returnValue.orderBy = container.data('order-by');
        }
        if (typeof container.data('order') !== 'undefined' && container.data('order') !== false) {                    
            returnValue.order = container.data('order');
        }
        if (typeof container.data('number') !== 'undefined' && container.data('number') !== false) {                    
            returnValue.number = container.data('number');
        }
		if (typeof container.data('image-size') !== 'undefined' && container.data('image-size') !== false) {
            returnValue.imageSize = container.data('image-size');
        }
        if (typeof container.data('filter') !== 'undefined' && container.data('filter') !== false) {                    
            returnValue.filter = container.data('filter');
        }
        if (typeof container.data('filter-order-by') !== 'undefined' && container.data('filter-order-by') !== false) {                    
            returnValue.filterOrderBy = container.data('filter-order-by');
        }
        if (typeof container.data('category') !== 'undefined' && container.data('category') !== false) {                    
            returnValue.category = container.data('category');
        }
        if (typeof container.data('selected-projects') !== 'undefined' && container.data('selected-projects') !== false) {                    
            returnValue.selectedProjectes = container.data('selected-projects');
        }
        if (typeof container.data('show-load-more') !== 'undefined' && container.data('show-load-more') !== false) {                    
            returnValue.showLoadMore = container.data('show-load-more');
        }
        if (typeof container.data('title-tag') !== 'undefined' && container.data('title-tag') !== false) {                    
            returnValue.titleTag = container.data('title-tag');
        }
        if (typeof container.data('next-page') !== 'undefined' && container.data('next-page') !== false) {                    
            returnValue.nextPage = container.data('next-page');
        }
        if (typeof container.data('max-num-pages') !== 'undefined' && container.data('max-num-pages') !== false) {                    
            returnValue.maxNumPages = container.data('max-num-pages');
        }
        return returnValue;
    }
     /**
     * Sets portfolio load more data params for ajax function
     * @param portfolio list container with defined data params
     * return array
     */
    function edgtfSetPortfolioAjaxData(container){
        var returnValue = {
            action: 'edgt_core_portfolio_ajax_load_more',
            type: container.type,
            columns: container.columns,
            gridSize: container.gridSize,
            orderBy: container.orderBy,
            order: container.order,
            number: container.number,
            imageSize: container.imageSize,
            filter: container.filter,
            filterOrderBy: container.filterOrderBy,
            category: container.category,
            selectedProjectes: container.selectedProjectes,
            showLoadMore: container.showLoadMore,
            titleTag: container.titleTag,
            nextPage: container.nextPage
        };
        return returnValue;
    }

    /**
     * Initializes Zig Zag Separator
     */
    function edgtfInitZigZagSeparator(){

        if($('.edgtf-zig-zag-separator-holder').length && $('.edgtf-no-animations-on-touch').length === 0){
            $('.edgtf-zig-zag-separator-holder').each(function(){
                var separator = $(this);
                separator.appear(function() {
                    separator.addClass('edgtf-zig-zag-separator-on');
                    edgtf.modules.common.edgtfCheckSVG(separator);
                },{accX: 0, accY: edgtfQuadricGlobalVars.vars.edgtfElementAppearAmount});
            });
        }

    }

    /**
     * Initializes SVG Icons
     */
    function edgtfInitSvgIcons(){

        if($('.edgtf-svg-icons').length && $('.edgtf-no-animations-on-touch').length === 0){
            $('.edgtf-svg-icons').each(function(){
                var icon = $(this);
                icon.appear(function() {
                    icon.addClass('edgtf-svg-icons-on');
                    edgtf.modules.common.edgtfCheckSVG(icon);
                },{accX: 0, accY: edgtfQuadricGlobalVars.vars.edgtfElementAppearAmount});
            });
        }

    }



    /**
     *	Holder with Revealing Background Script
     */
    function edgtfSetRevealingBackgrounds() {

        if ($('.edgtf-curtain-holder').length) {
            window.ech = new function() {
                this.$targets = $('.edgtf-curtain-holder');

                this.init = function() {
                    this.$targets
                        .mouseenter(function(e) {
                            ech.handleMouseenter($(this),e);
                        })
                        .mouseleave(function(e) {
                            ech.handle_mouseleave($(this),e);
                        })
                    ;
                };

                this.handleMouseenter = function($target,event) {
                    var offset = $target.offset();
                    var t = event.pageY - offset.top;
                    var b = $target.outerHeight() - t;
                    var l = event.pageX - offset.left;
                    var r = $target.outerWidth() - l;
                    var dir;
                    if (t <= b && t <= l && t <= r) {
                        dir = 'top';
                    }
                    else if (b < t && b <= l && b <= r) {
                        dir = 'bottom';
                    }
                    else if (l <= r && l < t && l < b) {
                        dir = 'left';
                    }
                    else if (r < l && r < t && r < b) {
                        dir = 'right';
                    }
                    else {
                        dir = "instant";
                    }
                    ech.makeChange($target,'in',dir);
                };

                this.handle_mouseleave = function($target,event) {
                    var offset = $target.offset();
                    var t = event.pageY - offset.top;
                    var b = $target.outerHeight();
                    var l = event.pageX - offset.left;
                    var r = $target.outerWidth();
                    var dir;
                    if (t <= 0 && t <= l && t <= r - l) {
                        dir = 'top';
                    }
                    else if (b <= t && b - t <= l && b - t <= r - l) {
                        dir = 'bottom';
                    }
                    else if (l <= 0 && l < t && l < b - t) {
                        dir = 'left';
                    }
                    else if (r <= l && r - l < t && r - l < b - t) {
                        dir = 'right';
                    }
                    else {
                        dir = "instant";
                    }
                    ech.makeChange($target,'out',dir);
                };

                this.makeChange = function($target,inout,dir) {
                    var opposite = {'top': 'bottom', 'bottom': 'top', 'left': 'right', 'right': 'left'};
                    var defaultImage = $target.is('.edgtf-default-image');
                    var duration = (dir=="instant") ? 0 : 300;
                    $target
                        .find('.edgtf-curtain.' + ((defaultImage) ? 'edgtf-curtain-'+dir : 'edgtf-curtain-'+opposite[dir]))
                        .addClass((inout==((defaultImage) ? "in" : "out")) ? 'edgtf-pulled' : '')
                        .removeClass((inout==((defaultImage) ? "out" : "in")) ? 'edgtf-pulled' : '')
                        .css({
                            '-webkit-transition': 'all '+duration+'ms ease 0ms',
                            '-transition': 'all '+duration+'ms ease 0ms',
                        })
                        .siblings()
                        .addClass((inout==((defaultImage) ? "in" : "out")) ? 'edgtf-pulled' : '')
                        .removeClass((inout==((defaultImage) ? "out" : "in")) ? 'edgtf-pulled' : '')
                        .css({
                            '-webkit-transition': 'all 0ms ease ' + ((inout==((defaultImage) ? "in" : "out")) ? duration : 0) + 'ms',
                            '-transition': 'all 0ms ease ' + ((inout==((defaultImage) ? "in" : "out")) ? duration : 0) + 'ms',
                        })
                    ;
                };
            };

            ech.init();
        }
    }


    /*
    * Init Icon Slider
    */

    var edgtfIconSlider = edgtf.modules.shortcodes.edgtfIconSlider = function() {

        var slidesWrapper = $('.edgtf-icon-slider-container');

        var initIconSlider = function(sliderWrapper){   

            var controlsHolder = sliderWrapper.find('.edgtf-icon-slider-controls-holder');
            var initialIconColor = sliderWrapper.find('.edgtf-icon-slider-nav-icon:not(.active)').css('color');
            var slider = sliderWrapper.find('.edgtf-icon-slider-container-inner');
            
            slider.owlCarousel({
                items: 1,
                nav: false,
                dots: true,
                dotsContainer: '.edgtf-icon-slider-controls-holder-inner',
                onInitialized: function(){
                    controlsHolder.show();
                    initIconSliderStyle(initialIconColor, controlsHolder);
                },
                onTranslated: function(){
                    initIconSliderStyle(initialIconColor, controlsHolder);
                }
            });
        }

        var initIconSliderStyle = function(initialColor, controls){
            var iconActiveColor = controls.data('icon-active-color');
            
            if(iconActiveColor != "" && typeof(iconActiveColor) != 'undefined'){
                var icons = controls.find('.edgtf-icon-slider-nav-icon');
                var hoverOutColor = '';
                icons.each(function(){
                    if($(this).hasClass('active')){
                        $(this).css('color',iconActiveColor);
                    }else{
                        $(this).css('color',initialColor);
                    }
                });
	
	            icons.on('mouseenter', function(){
		            hoverOutColor = $(this).css('color');
		            $(this).css('color',iconActiveColor);
	            });
	
	            icons.on('mouseleave', function(){
		            if($(this).hasClass('active')){ // if the icon is hovered before it was active
			            hoverOutColor = iconActiveColor;
		            }
		            $(this).css('color',hoverOutColor);
	            });
            }
        }

        return {
            init: function(){
                if(slidesWrapper.length){
                    slidesWrapper.each(function(){
                        initIconSlider($(this));
                    });
                }
            }
        }
    }

    function edgtfInitContentSlider(){
        var slidesWrapper = $('.edgtf-content-slider-container');
        if(slidesWrapper.length){
            slidesWrapper.each(function(){
                var index = 1;

                /* after slider initialization add dots number */

                $(this).on('initialized.owl.carousel',function(event){
                    $(this).find('.owl-dot').each(function(){
                        $(this).text(index++);
                    });
                });

                $(this).owlCarousel({
                    items:1,
                    dots:true,
                    nav:false        
                });

            })
        }
    }

    function edgtfInitTeamSlider(){
        var slidesWrapper = $('.edgtf-team-slider-container');
        if(slidesWrapper.length){
            slidesWrapper.each(function(){
                $(this).owlCarousel({
                    loop:true,
                    items:1,
                    dots:true,
                    nav:true,
                    navText:['<i class="icon-arrows-left">','<i class="icon-arrows-right"></i>']        
                });
            })
        }
    }

    function edgtfInitZoomingSlider(){
        var sliders = $('.edgtf-zooming-slider');
        if(sliders.length){
            var flag = 0;
            var item = '';
            var indexOfLastItem = ''; // last item in a loop; before it moves to the first slide; next-to-last clone
            var numOfClones = ''; // last item in a loop; before it moves to the first slide; next-to-last clone
            var stage = '';
            var posX = '';

            sliders.on('initialized.owl.carousel',function(e){
                var items = $(this).find('div.owl-item');
                numOfClones = (items.length-e.item.count)/2;
                indexOfLastItem = e.item.count+numOfClones;
                item = items.eq(numOfClones).find('.edgtf-zooming-slider-slide');
                posX = -item.width()*numOfClones;
                stage = $('.owl-stage');
            });


            sliders.on('resized.owl.carousel',function(e){
                posX = -item.width()*numOfClones;
            });

            sliders.on('translate.owl.carousel',function(e){
                if(e.item.index == indexOfLastItem){
                    item.addClass('active');
                    flag = 1;
                }else{
                    item.removeClass('active');
                }
            });

            sliders.on('translated.owl.carousel',function(e){
                if(flag){
                    stage.css({
                        transform: "translate3d("+posX+", 0, 0)",
                        transition: "0s",
                        "transition-delay": '500ms', //css transition-duration of each slide (zooming animation)
                    });
                    flag = 0;
                }
            });

            sliders.owlCarousel({
                dots:true,
                nav:false,
                loop:true,
                autoplay:true,
                autoplayTimeout:5000,
                center:false,
                autoplayHoverPause:true,
                items:1,
                mouseDrag:false,
                touchDrag:false,
                pullDrag:false
            });
        }
    }

    if ($('.edgtf-floating-slider').length) {
        var edgtfFS = {};

        edgtfFS.$slider = $('.edgtf-floating-slider');
        edgtfFS.change_duration = edgtfFS.$slider.data('changeduration') / 1000; // in seconds
        edgtfFS.zoom_out = edgtfFS.$slider.data('zoomout');
        edgtfFS.hide_slides = edgtfFS.$slider.attr('data-nav-hide').length ? edgtfFS.$slider.attr('data-nav-hide').split(',') : [];
        for (var i=0; i<edgtfFS.hide_slides.length; i++) edgtfFS.hide_slides[i] = parseInt(edgtfFS.hide_slides[i],10);
        edgtfFS.$slides = edgtfFS.$slider.find('.edgtf-fs-slide');
        edgtfFS.$front = edgtfFS.$slider.find('.edgtf-fs-front-content-inner');
        edgtfFS.$background = edgtfFS.$slider.find('.edgtf-fs-background-elements');
        edgtfFS.$nav = edgtfFS.$slider.siblings('.edgtf-fs-nav');
        edgtfFS.$nav_buttons = edgtfFS.$nav.find('.nav_but');
        edgtfFS.$nav_arrows = edgtfFS.$nav.find('.nav_arr');
        edgtfFS.background = {
            dir: "",
            zigzag: "",
            randsize: "",
            floater: {
                width: 0,
                height: 0,
                src: "",
                speed: 0,
            },
        };
        edgtfFS.changing = false;

        edgtfFS.change_slide = function(dir) {
            var change = (dir=='next' ? 1 : -1);
            var curr = edgtfFS.$slides.filter('.current').index() + 1;
            edgtfFS.showSlideContent((curr-1 + change + edgtfFS.$slides.length)%edgtfFS.$slides.length + 1);
            edgtfFS.$nav_buttons.eq((curr-1 + change + edgtfFS.$slides.length)%edgtfFS.$slides.length).addClass('current').siblings().removeClass('current');
        };

        edgtfFS.init = function() {
            edgtfFS.$nav_buttons.on('click', function() {
                edgtfFS.showSlideContent(parseInt($(this).children('span').html(),10), true);
                $(this).addClass('current').siblings().removeClass('current');
            });
            edgtfFS.$nav_arrows.on('click', function() {
                var dir = $(this).is('.prev') ? 'prev' : 'next'; 
                edgtfFS.change_slide(dir);
            });
            $(window).on("resize orientationchange", function() {
                edgtfFS.$front.height($(window).height() - ($('.edgtf-mobile-header').is(':visible') ? $('.edgtf-mobile-header-inner').height() : 0));
            });
            edgtfFS.$slider.on("mousewheel", edgtfFS.handle_scroll);
            edgtfFS.$slider.on("DOMMouseScroll", edgtfFS.handle_scroll);
            $(window).on("keydown", edgtfFS.handle_keys);
            $(window).on("touchstart", edgtfFS.handle_touchstart);
            $(window).on("touchmove", edgtfFS.handle_touchmove);
            edgtfFS.$front.height($(window).height() - ($('.edgtf-mobile-header').is(':visible') ? $('.edgtf-mobile-header-inner').height() : 0));
            edgtfFS.dimensionFrontContent();
            var big_dim = Math.max(edgtfFS.$slider.outerHeight(), edgtfFS.$slider.outerWidth()) * 3;
            edgtfFS.$slider.find('.edgtf-fs-background-elements-inner').css({
                'width': big_dim + 'px',
                'height': big_dim + 'px',
                'margin-left': -big_dim/2 + 'px',
                'margin-top': -big_dim/2 + 'px',
            });
            edgtfFS.$nav_buttons.eq(0).click(); 
        };

        edgtfFS.floatBackgroundElements = function() {
            clearTimeout(edgtfFS.float_timeout);
            edgtfFS.$background.find('.edgtf-fs-background-elements-inner').css({
                '-webkit-transform':'',
                'transform':'',
                '-webkit-transition': 'none',
                'transition': 'none',
                'left': edgtfFS.$background.width() / 2 + 'px',
                'top': edgtfFS.$background.height() / 2 + 'px'
            }).find('.floater').remove();
            if (edgtfFS.background.floater) {
                var floater = {
                    width: edgtfFS.background.floater.width, //$floater.width(),
                    height: edgtfFS.background.floater.height, //$floater.height(),
                    src: edgtfFS.background.floater.src, //$floater.find('img').attr('src'),
                };
                var dir = edgtfFS.background.dir; //$('.edgtf-fs-background-elements').data('dir'); // Direction
                var zigzag = (edgtfFS.background.zigzag == "yes") ? -1 : 1; // Movement in opposite directions
                var randsize = (edgtfFS.background.randsize == "yes") ? 1 : 0; // Random scales of background element
                var final_offset = {
                    x: 0,
                    y: 0,
                }
                var big_dimension = edgtfFS.$background.find('.edgtf-fs-background-elements-inner').width();
                var max_offset = big_dimension / 2;
                var distance = {
                    x: 0,
                    y: 0,
                }
                var path_rotation = 0;
                var change_duration = edgtfFS.change_duration;
                
                switch (dir) {
                    case "top-bottom": case "bottom-top":
                    distance.x = 1 * floater.height;
                    distance.y = 1 * floater.width;
                    path_rotation = 90;
                    break;

                    case "left-right": case "right-left":
                    distance.x = 1 * floater.width;
                    distance.y = 1 * floater.height;
                    path_rotation = 0;
                    break;

                    case 'top-left-bottom-right':
                    case 'bottom-right-top-left':
                        max_offset *= 1.44;
                        path_rotation = -45;
                        distance.x = 1 * Math.pow(floater.width*floater.width + floater.height*floater.height, 0.5);
                        distance.y = 1 * Math.pow(floater.width*floater.width + floater.height*floater.height, 0.5);
                    break;

                    case 'top-right-bottom-left':
                    case 'bottom-left-top-right':
                        max_offset *= 1.44;
                        path_rotation = 45;
                        distance.x = 1 * Math.pow(floater.width*floater.width + floater.height*floater.height, 0.5);
                        distance.y = 1 * Math.pow(floater.width*floater.width + floater.height*floater.height, 0.5);
                    break;
                }
                
                // Positioning the background elements - Start
                var coords = [ [], [] ];
                for (var y = 0, i = 0; y < max_offset; y += distance.y, i++) {
                    for (var x = (i%2)*distance.x/2; x < max_offset; x += distance.x) {
                        coords[i%2].push({x: x, y: y});
                        if (x) coords[i%2].push({x: -x, y: y});
                        if (y) coords[i%2].push({x: x, y: -y});
                        if (x&&y) coords[i%2].push({x: -x, y: -y});
                    }
                }
                for (var j=0; j<2; j++) {
                    var floaters_html = "";
                    for (var i=0; i<coords[j].length; i++) {
                        var r = Math.pow(coords[j][i].x*coords[j][i].x + coords[j][i].y*coords[j][i].y, 0.5);
                        var f = ( (coords[j][i].y) ? (Math.atan(coords[j][i].y / coords[j][i].x) + (coords[j][i].x < 0)*Math.PI) : ((coords[j][i].x < 0) ? -Math.PI : 0) ) + path_rotation/180*Math.PI;
                        coords[j][i] = {
                            x: (r * Math.cos(f) + distance.x/2) / big_dimension * 100 + 50,
                            y: (-r * Math.sin(f) + distance.y/2) / big_dimension * 100 + 50,
                        }
                        floaters_html +=
                            '<div class="floater" style="top: '+coords[j][i].y+'%; left: '+coords[j][i].x+'%; -webkit-transform: translate(-50%,-50%) scale('+(randsize ? (Math.random()*0.6+0.4) : 1)+'); transform: translate(-50%,-50%) scale('+(randsize ? (Math.random()*0.6+0.4) : 1)+'); ">' +
                                '<img src="'+floater.src+'">' +
                            '</div>'
                        ;
                    }
                    edgtfFS.$background.find('.edgtf-fs-background-elements-inner.fs-bei-'+(j+1)).html(floaters_html);
                }
                // Positioning the background elements - End

                if (dir == "top-bottom" || dir == "top-right-bottom-left" || dir == "top-left-bottom-right") final_offset.y = 1;
                else if (dir == "bottom-top" || dir == "bottom-left-top-right" || dir == "bottom-right-top-left") final_offset.y = -1;
                else final_offset.y = 0;
                if (dir == "left-right" || dir == "top-left-bottom-right" || dir == "bottom-left-top-right") final_offset.x = 1;
                else if (dir == "right-left" || dir == "top-right-bottom-left" || dir == "bottom-right-top-left") final_offset.x = -1;
                else final_offset.x = 0;
                var shift_x = big_dimension/3*final_offset.x, shift_y = big_dimension/3*final_offset.y;
                var transition_duration = Math.round(Math.pow(shift_x*shift_x + shift_y*shift_y, 0.5) / edgtfFS.background.floater.speed);
                
                if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) {
                    edgtfFS.$background.find('.edgtf-fs-background-elements-inner.fs-bei-1').addClass('running').find('.floater').animate({
                        'top': '+='+shift_y+'px',
                        'left': '+='+shift_x+'px'
                    }, transition_duration*1000, 'linear');
                    edgtfFS.$background.find('.edgtf-fs-background-elements-inner.fs-bei-2').addClass('running').find('.floater').animate({
                        'top': '+='+(shift_y*zigzag)+'px',
                        'left': '+='+(shift_x*zigzag)+'px'
                    }, transition_duration*1000, 'linear');
                }
                else {
                    edgtfFS.$background.find('.edgtf-fs-background-elements-inner').css({
                        '-webkit-transition': '-webkit-transform '+transition_duration+'s ease-out, opacity '+change_duration+'s ease, filter '+change_duration+'s ease', /* IE has problems with cubic-bezier(0, 0.15, 0, 0) easing on transform */
                        'transition': 'transform '+transition_duration+'s ease-out, opacity '+change_duration+'s ease, filter '+change_duration+'s ease', /* IE has problems with cubic-bezier(0, 0.15, 0, 0) easing on transform */
                    });
                    edgtfFS.$background.find('.edgtf-fs-background-elements-inner.fs-bei-1').addClass('running').css({
                        '-webkit-transform':'translate('+shift_x+'px, '+shift_y+'px)',
                        'transform':'translate('+shift_x+'px, '+shift_y+'px)',
                    });
                    edgtfFS.$background.find('.edgtf-fs-background-elements-inner.fs-bei-2').addClass('running').css({
                        '-webkit-transform': 'translate('+(shift_x*zigzag)+'px, '+(shift_y*zigzag)+'px)',
                        'transform': 'translate('+(shift_x*zigzag)+'px, '+(shift_y*zigzag)+'px)',
                    }).one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() {
                        //if (!edgtfFS.changing) edgtfFS.floatBackgroundElements();
                    });
                }


                edgtfFS.float_timeout = setTimeout(function() {
                    if (!edgtfFS.changing) {
                        edgtfFS.unfloatBackgroundElements();
                        setTimeout(function() {
                            edgtfFS.floatBackgroundElements();
                        }, change_duration*1000);
                    }
                },(transition_duration)*1000);
            }
        };

        edgtfFS.unfloatBackgroundElements = function() {
            var change_duration = edgtfFS.change_duration;
            edgtfFS.$background.find('.edgtf-fs-background-elements-inner.running').removeClass('running').css({
                '-webkit-transform': 'translate(0,0)',
                'transform': 'translate(0,0)',
                '-webkit-transition': '-webkit-transform 0s linear '+change_duration+'s, opacity '+change_duration+'s ease, filter '+change_duration+'s ease',
                'transition': 'transform 0s linear '+change_duration+'s, opacity '+change_duration+'s ease, filter '+change_duration+'s ease',
            });
        };

        edgtfFS.dimensionFrontContent = function() {
            edgtfFS.$slides.each(function() {
                $(this).find('.fs-container').each(function() {
                    var container = $(this);
                    container.css({
                        'width': container.data("width") + '%',
                        'height': container.attr('data-height') ? (container.data("height") + '%') : '',
                        'max-height': container.attr('data-max-height') ? (container.data("max-height") + '%') : '',
                        'left': container.data("left") + '%',
                        '-webkit-transform': 'translate(-50%,100%) scale('+edgtfFS.zoom_out+')',
                        'transform': 'translate(-50%,100%) scale('+edgtfFS.zoom_out+')',
                    });
                });
            });
        };

        edgtfFS.showSlideContent = function(slide_no, jump, direction) {
            edgtfFS.changing = true;
            if (edgtfFS.$slides.eq(slide_no-1).is('.current')) return;
            
            edgtfFS.unfloatBackgroundElements();

            if (edgtfFS.hide_slides.indexOf(slide_no) < 0) {
                edgtfFS.$nav.fadeIn(edgtfFS.change_duration*1000);
                $('.edgtf-page-header').animate({opacity: 1}, edgtfFS.change_duration*1000);
            }
            else {
                edgtfFS.$nav.fadeOut(edgtfFS.change_duration*1000);
                $('.edgtf-page-header').animate({opacity: 0}, edgtfFS.change_duration*1000);
            }
            var nav_but = edgtfFS.$nav_buttons.eq(slide_no-1).addClass('current seen');
            nav_but.prevAll().addClass('seen');
            nav_but.nextAll().removeClass('seen');
            
            if (!jump) direction = (direction=="next") ? 1 : -1;
            for (var i=1; i<=edgtfFS.$slides.length; i++) {
                var this_slide = edgtfFS.$slides.eq(i-1);
                var target = i==slide_no;
                var current = this_slide.is('.current') && !target;
                var target = i==slide_no;
                /*
                var offsets = [
                    [50],
                    [45, 55],
                    [50, 45, 55],
                    [45, 50, 45, 55],
                ];
                */
                var no_of_containers = this_slide.find('.fs-container').length;
                if (target) {
                    edgtfFS.background = (this_slide.attr('data-floatersrc')) ? 
                    {
                        dir: this_slide.data('dir'),
                        zigzag: this_slide.data('zigzag'),
                        randsize: this_slide.data('randsize'),
                        floater: {
                            width: this_slide.data('floaterwidth'),
                            height: this_slide.data('floaterheight'),
                            src: this_slide.data('floatersrc'),
                            speed: this_slide.data('floaterspeed'),
                        },
                    } 
                    :
                    {};
                }
                
                this_slide
                .addClass( (target) ? 'current' : '' )
                .removeClass( (current) ? 'current' : '' )
                .find('.fs-container').each(function() {
                    var this_container = $(this);
                    this_container.css({
                        'opacity': (target || current) ? '1' : '0',
                        'filter': 'alpha(opacity=' + ((target || current) ? '100' : '0') + ')',
                        '-webkit-transform': 'translate(-50%, -'+ (50 + (!target) * ((i<slide_no)?50:-50)) + '%) scale('+((target)*(1-edgtfFS.zoom_out)+edgtfFS.zoom_out)+')', 
                        'transform': 'translate(-50%,-'+ (50 + (!target) * ((i<slide_no)?50:-50)) + '%) scale('+((target)*(1-edgtfFS.zoom_out)+edgtfFS.zoom_out)+')', 
                        '-webkit-transition-property': '-webkit-transform, top',
                        'transition-property': 'transform, top',
                        '-webkit-transition-duration': (current || target) ? edgtfFS.change_duration+'s' : '0s',
                        'transition-duration': (current || target) ? edgtfFS.change_duration+'s' : '0s',
                        '-webkit-transition-timing-function': 'ease',
                        'transition-timing-function': 'ease',
                        //'-webkit-transition-delay': ((target) ? edgtfFS.change_duration/2 : 0) + this_container.index() * edgtfFS.change_duration/2 / no_of_containers +'s',
                        //'transition-delay': ((target) ? edgtfFS.change_duration/2 : 0) + this_container.index() * edgtfFS.change_duration/2 / no_of_containers +'s',
                        //'-webkit-transition-delay': ((target) ? edgtfFS.change_duration/2 : 0) + ((!target) ? this_container.index() : no_of_containers - 1 - this_container.index()) * edgtfFS.change_duration/2 / no_of_containers +'s',
                        //'transition-delay': ((target) ? edgtfFS.change_duration/2 : 0) + ((!target) ? this_container.index() : no_of_containers - 1 - this_container.index()) * edgtfFS.change_duration/2 / no_of_containers +'s',
                        '-webkit-transition-delay': ((target) ? edgtfFS.change_duration/2 : 0) + ((!target) ? no_of_containers - 1 - this_container.index() : this_container.index()) * edgtfFS.change_duration/2 / no_of_containers +'s',
                        'transition-delay': ((target) ? edgtfFS.change_duration/2 : 0) + ((!target) ? no_of_containers - 1 - this_container.index() : this_container.index()) * edgtfFS.change_duration/2 / no_of_containers +'s',
                        'top': ((target) ? this_container.data("top") : 50) + (!target) * ((i<slide_no)?-55:55) + '%',
                    });
                });
            }
            setTimeout(function() {
                edgtfFS.floatBackgroundElements();
                edgtfFS.changing = false;
            }, edgtfFS.change_duration*1000*2);
        };

        edgtfFS.handle_scroll = function(e) {
            if (!edgtfFS.changing) {
                e.preventDefault();
                var e = window.event || e.originalEvent;
                var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));
                edgtfFS.change_slide(delta == 1 ? 'prev' : 'next');
            }
        };

        edgtfFS.handle_keys = function(e) {
            if (!edgtfFS.changing) {
                if (e.keyCode == 38 || e.keyCode == 33) {
                    e.preventDefault();
                    edgtfFS.change_slide('prev');
                }
                else if (e.keyCode == 40 || e.keyCode == 34) {
                    e.preventDefault();
                    edgtfFS.change_slide('next');
                }
            }
        };

        edgtfFS.handle_touchstart = function(e) {
            if (!edgtfFS.changing) {
                edgtfFS.touch_start = e.originalEvent.touches[0].pageY;
            }
        };

        edgtfFS.handle_touchmove = function(e) {
            if (!edgtfFS.changing) {
                if ($(e.target).parents('.edgtf-floating-slider').length) {
                    console.log('Na njemu');
                    e.preventDefault();
                }
                if (!edgtfFS.touch_start) {
                    return;
                } else if (edgtfFS.touch_start > e.originalEvent.touches[0].pageY) {
                    edgtfFS.change_slide('next');
                } else if (edgtfFS.touch_start < e.originalEvent.touches[0].pageY) {
                    edgtfFS.change_slide('prev');
                }
            }
        };

        edgtfFS.init();

        shortcodes.edgtfFloatingSlider = edgtfFS; 
    }

	/**
	 * Slider object that initializes whole slider functionality
	 * @type {Function}
	 */
	var edgtfSlider = edgtf.modules.shortcodes.edgtfSlider = function() {

		//all sliders on the page
		var sliders = $('.edgtf-slider .carousel');
		//image regex used to extract img source
		var imageRegex = /url\(["']?([^'")]+)['"]?\)/;
		//default responsive breakpoints set
		var responsiveBreakpointSet = [1600,1200,900,650,500,320];
		//var init for coefficiens array
		var coefficientsGraphicArray;
		var coefficientsTitleArray;
		var coefficientsSubtitleArray;
		var coefficientsTextArray;
		var coefficientsButtonArray;
		//var init for slider elements responsive coefficients
		var sliderGraphicCoefficient;
		var sliderTitleCoefficient;
		var sliderSubtitleCoefficient;
		var sliderTextCoefficient;
		var sliderButtonCoefficient;
		var sliderTitleCoefficientLetterSpacing;
		var sliderSubtitleCoefficientLetterSpacing;
		var sliderTextCoefficientLetterSpacing;

		/*** Functionality for translating image in slide - START ***/

		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'};

		// regular expression for parsing out the matrix components from the matrix string
		var matrixRE = /\([0-9epx\.\, \t\-]+/gi;

		// parses a matrix string of the form "matrix(n1,n2,n3,n4,n5,n6)" and
		// returns an array with the matrix components
		var parseMatrix = function (val) {
			return val.match(matrixRE)[0].substr(1).
				split(",").map(function (s) {
					return parseFloat(s);
				});
		};

		// transform css property names with vendor prefixes;
		// the plugin will check for values in the order the names are listed here and return as soon as there
		// is a value; so listing the W3 std name for the transform results in that being used if its available
		var transformPropNames = [
			"transform",
			"-webkit-transform"
		];

		var getTransformMatrix = function (el) {
			// iterate through the css3 identifiers till we hit one that yields a value
			var matrix = null;
			transformPropNames.some(function (prop) {
				matrix = el.css(prop);
				return (matrix !== null && matrix !== "");
			});

			// if "none" then we supplant it with an identity matrix so that our parsing code below doesn't break
			matrix = (!matrix || matrix === "none") ?
				"matrix(1,0,0,1,0,0)" : matrix;
			return parseMatrix(matrix);
		};

		// set the given matrix transform on the element; note that we apply the css transforms in reverse order of how its given
		// in "transformPropName" to ensure that the std compliant prop name shows up last
		var setTransformMatrix = function (el, matrix) {
			var m = "matrix(" + matrix.join(",") + ")";
			for (var i = transformPropNames.length - 1; i >= 0; --i) {
				el.css(transformPropNames[i], m + ' rotate(0.01deg)');
			}
		};

		// interpolates a value between a range given a percent
		var interpolate = function (from, to, percent) {
			return from + ((to - from) * (percent / 100));
		};

		$.fn.transformAnimate = function (opt) {
			// extend the options passed in by caller
			var options = {
				transform: "matrix(1,0,0,1,0,0)"
			};
			$.extend(options, opt);

			// initialize our custom property on the element to track animation progress
			this.css("percentAnim", 0);

			// supplant "options.step" if it exists with our own routine
			var sourceTransform = getTransformMatrix(this);
			var targetTransform = parseMatrix(options.transform);
			options.step = function (percentAnim, fx) {
				// compute the interpolated transform matrix for the current animation progress
				var $this = $(this);
				var matrix = sourceTransform.map(function (c, i) {
					return interpolate(c, targetTransform[i],
						percentAnim);
				});

				// apply the new matrix
				setTransformMatrix($this, matrix);

				// invoke caller's version of "step" if one was supplied;
				if (opt.step) {
					opt.step.apply(this, [matrix, fx]);
				}
			};

			// animate!
			return this.stop().animate({ percentAnim: 100 }, options);
		};

		/*** Functionality for translating image in slide - END ***/


		/**
		 * Calculate heights for slider holder and slide item, depending on window width, but only if slider is set to be responsive
		 * @param slider, current slider
		 * @param defaultHeight, default height of slider, set in shortcode
		 * @param responsive_breakpoint_set, breakpoints set for slider responsiveness
		 * @param reset, boolean for reseting heights
		 */
		var setSliderHeight = function(slider, defaultHeight, responsive_breakpoint_set, reset) {
			var sliderHeight = defaultHeight;
			if(!reset) {
				if(edgtf.windowWidth > responsive_breakpoint_set[0]) {
					sliderHeight = defaultHeight;
				} else if(edgtf.windowWidth > responsive_breakpoint_set[1]) {
					sliderHeight = defaultHeight * 0.75;
				} else if(edgtf.windowWidth > responsive_breakpoint_set[2]) {
					sliderHeight = defaultHeight * 0.6;
				} else if(edgtf.windowWidth > responsive_breakpoint_set[3]) {
					sliderHeight = defaultHeight * 0.55;
				} else if(edgtf.windowWidth <= responsive_breakpoint_set[3]) {
					sliderHeight = defaultHeight * 0.45;
				}
			}

			slider.css({'height': (sliderHeight) + 'px'});
			slider.find('.edgtf-slider-preloader').css({'height': (sliderHeight) + 'px'});
			slider.find('.edgtf-slider-preloader .edgtf-ajax-loader').css({'display': 'block'});
			slider.find('.item').css({'height': (sliderHeight) + 'px'});
		}

		/**
		 * Calculate heights for slider holder and slide item, depending on window size, but only if slider is set to be full height
		 * @param slider, current slider
		 */
		var setSliderFullHeight = function(slider) {
			var mobileHeaderHeight = edgtf.windowWidth <= 1024 ? edgtfQuadricGlobalVars.vars.edgtfMobileHeaderHeight + $('.edgtf-top-bar').height() : 0;
			slider.css({'height': (edgtf.windowHeight - mobileHeaderHeight) + 'px'});
			slider.find('.edgtf-slider-preloader').css({'height': (edgtf.windowHeight - mobileHeaderHeight) + 'px'});
			slider.find('.edgtf-slider-preloader .edgtf-ajax-loader').css({'display': 'block'});
			slider.find('.item').css({'height': (edgtf.windowHeight - mobileHeaderHeight) + 'px'});
		}

		/**
		 * Set initial sizes for slider elements and put them in global variables
		 * @param slideItem, each slide
		 * @param index, index od slide item
		 */
		var setSizeGlobalVariablesForSlideElements = function(slideItem, index) {
			window["slider_graphic_width_" + index] = [];
			window["slider_graphic_height_" + index] = [];
			//window["slider_svg_width_" + index] = [];
			//window["slider_svg_height_" + index] = [];
			window["slider_title_" + index] = [];
			window["slider_subtitle_" + index] = [];
			window["slider_text_" + index] = [];
			window["slider_button1_" + index] = [];
			window["slider_button2_" + index] = [];

			//graphic size
			window["slider_graphic_width_" + index].push(parseFloat(slideItem.find('.edgtf-thumb img').data("width")));
			window["slider_graphic_height_" + index].push(parseFloat(slideItem.find('.edgtf-thumb img').data("height")));

			//svg size
			//window["slider_svg_width_" + index].push(parseFloat(slideItem.find('.edgtf-slider-svg svg').attr("width")));
			//window["slider_svg_height_" + index].push(parseFloat(slideItem.find('.edgtf-slider-svg svg').attr("height")));

			// font-size (0)
			window["slider_title_" + index].push(parseFloat(slideItem.find('.edgtf-slide-title').css("font-size")));
			window["slider_subtitle_" + index].push(parseFloat(slideItem.find('.edgtf-slide-subtitle').css("font-size")));
			window["slider_text_" + index].push(parseFloat(slideItem.find('.edgtf-slide-text').css("font-size")));
			window["slider_button1_" + index].push(parseFloat(slideItem.find('.edgtf-btn:eq(0)').css("font-size")));
			window["slider_button2_" + index].push(parseFloat(slideItem.find('.edgtf-btn:eq(1)').css("font-size")));

			// line-height (1)
			window["slider_title_" + index].push(parseFloat(slideItem.find('.edgtf-slide-title').css("line-height")));
			window["slider_subtitle_" + index].push(parseFloat(slideItem.find('.edgtf-slide-subtitle').css("line-height")));
			window["slider_text_" + index].push(parseFloat(slideItem.find('.edgtf-slide-text').css("line-height")));
			window["slider_button1_" + index].push(parseFloat(slideItem.find('.edgtf-btn:eq(0)').css("line-height")));
			window["slider_button2_" + index].push(parseFloat(slideItem.find('.edgtf-btn:eq(1)').css("line-height")));

			// letter-spacing (2)
			window["slider_title_" + index].push(parseFloat(slideItem.find('.edgtf-slide-title').css("letter-spacing")));
			window["slider_subtitle_" + index].push(parseFloat(slideItem.find('.edgtf-slide-subtitle').css("letter-spacing")));
			window["slider_text_" + index].push(parseFloat(slideItem.find('.edgtf-slide-text').css("letter-spacing")));
			window["slider_button1_" + index].push(parseFloat(slideItem.find('.edgtf-btn:eq(0)').css("letter-spacing")));
			window["slider_button2_" + index].push(parseFloat(slideItem.find('.edgtf-btn:eq(1)').css("letter-spacing")));

			// margin-bottom (3)
			window["slider_title_" + index].push(parseFloat(slideItem.find('.edgtf-slide-title').css("margin-bottom")));
			window["slider_subtitle_" + index].push(parseFloat(slideItem.find('.edgtf-slide-subtitle').css("margin-bottom")));


			// slider_button padding top/bottom(3), padding left/right(4)
			window["slider_button1_" + index].push(parseFloat(slideItem.find('.edgtf-btn:eq(0)').css("padding-top")));
			window["slider_button2_" + index].push(parseFloat(slideItem.find('.edgtf-btn:eq(1)').css("padding-top")));

			window["slider_button1_" + index].push(parseFloat(slideItem.find('.edgtf-btn:eq(0)').css("padding-left")));
			window["slider_button2_" + index].push(parseFloat(slideItem.find('.edgtf-btn:eq(1)').css("padding-left")));

		}

		/**
		 * Set responsive coefficients for slider elements
		 * @param responsiveBreakpointSet, responsive breakpoints
		 * @param coefficientsGraphicArray, responsive coeaficcients for graphic
		 * @param coefficientsTitleArray, responsive coeaficcients for title
		 * @param coefficientsSubtitleArray, responsive coeaficcients for subtitle
		 * @param coefficientsTextArray, responsive coeaficcients for text
		 * @param coefficientsButtonArray, responsive coeaficcients for button
		 */
		var setSliderElementsResponsiveCoeffeicients = function(responsiveBreakpointSet,coefficientsGraphicArray,coefficientsTitleArray,coefficientsSubtitleArray,coefficientsTextArray,coefficientsButtonArray) {

			function coefficientsSetter(graphicArray,titleArray,subtitleArray,textArray,buttonArray){
				sliderGraphicCoefficient = graphicArray;
				sliderTitleCoefficient = titleArray;
				sliderSubtitleCoefficient = subtitleArray;
				sliderTextCoefficient = textArray;
				sliderButtonCoefficient = buttonArray;
			}

			if(edgtf.windowWidth > responsiveBreakpointSet[0]) {
				coefficientsSetter(coefficientsGraphicArray[0],coefficientsTitleArray[0],coefficientsSubtitleArray[0],coefficientsTextArray[0],coefficientsButtonArray[0]);
			}else if(edgtf.windowWidth > responsiveBreakpointSet[1]){
				coefficientsSetter(coefficientsGraphicArray[1],coefficientsTitleArray[1],coefficientsSubtitleArray[1],coefficientsTextArray[1],coefficientsButtonArray[1]);
			}else if(edgtf.windowWidth > responsiveBreakpointSet[2]){
				coefficientsSetter(coefficientsGraphicArray[2],coefficientsTitleArray[2],coefficientsSubtitleArray[2],coefficientsTextArray[2],coefficientsButtonArray[2]);
			}else if(edgtf.windowWidth > responsiveBreakpointSet[3]){
				coefficientsSetter(coefficientsGraphicArray[3],coefficientsTitleArray[3],coefficientsSubtitleArray[3],coefficientsTextArray[3],coefficientsButtonArray[3]);
			}else if (edgtf.windowWidth > responsiveBreakpointSet[4]) {
				coefficientsSetter(coefficientsGraphicArray[4],coefficientsTitleArray[4],coefficientsSubtitleArray[4],coefficientsTextArray[4],coefficientsButtonArray[4]);
			}else if (edgtf.windowWidth > responsiveBreakpointSet[5]){
				coefficientsSetter(coefficientsGraphicArray[5],coefficientsTitleArray[5],coefficientsSubtitleArray[5],coefficientsTextArray[5],coefficientsButtonArray[5]);
			}else{
				coefficientsSetter(coefficientsGraphicArray[6],coefficientsTitleArray[6],coefficientsSubtitleArray[6],coefficientsTextArray[6],coefficientsButtonArray[6]);
			}

			// letter-spacing decrease quicker
			sliderTitleCoefficientLetterSpacing = sliderTitleCoefficient;
			sliderSubtitleCoefficientLetterSpacing = sliderSubtitleCoefficient;
			sliderTextCoefficientLetterSpacing = sliderTextCoefficient;
			if(edgtf.windowWidth <= responsiveBreakpointSet[0]) {
				sliderTitleCoefficientLetterSpacing = sliderTitleCoefficient/2;
				sliderSubtitleCoefficientLetterSpacing = sliderSubtitleCoefficient/2;
				sliderTextCoefficientLetterSpacing = sliderTextCoefficient/2;
			}
		}

		/**
		 * Set sizes for slider elements
		 * @param slideItem, each slide
		 * @param index, index od slide item
		 * @param reset, boolean for reseting sizes
		 */
		var setSliderElementsSize = function(slideItem, index, reset) {

			if(reset) {
				sliderGraphicCoefficient = sliderTitleCoefficient = sliderSubtitleCoefficient = sliderTextCoefficient = sliderButtonCoefficient = sliderTitleCoefficientLetterSpacing = sliderSubtitleCoefficientLetterSpacing = sliderTextCoefficientLetterSpacing = 1;
			}

			slideItem.find('.edgtf-thumb').css({
				"width": Math.round(window["slider_graphic_width_" + index][0]*sliderGraphicCoefficient) + 'px',
				"height": Math.round(window["slider_graphic_height_" + index][0]*sliderGraphicCoefficient) + 'px'
			});

			//slideItem.find('.edgtf-slider-svg svg').css({
			//	"width": Math.round(window["slider_svg_width_" + index][0]*sliderGraphicCoefficient) + 'px',
			//	"height": Math.round(window["slider_svg_height_" + index][0]*sliderGraphicCoefficient) + 'px'
			//});

			slideItem.find('.edgtf-slide-title').css({
				"font-size": Math.round(window["slider_title_" + index][0]*sliderTitleCoefficient) + 'px',
				"line-height": Math.round(window["slider_title_" + index][1]*sliderTitleCoefficient) + 'px',
				"letter-spacing": Math.round(window["slider_title_" + index][2]*sliderTitleCoefficient) + 'px',
				"margin-bottom": Math.round(window["slider_title_" + index][3]*sliderTitleCoefficient) + 'px'
			});

			slideItem.find('.edgtf-slide-subtitle').css({
				"font-size": Math.round(window["slider_subtitle_" + index][0]*sliderSubtitleCoefficient) + 'px',
				"line-height": Math.round(window["slider_subtitle_" + index][1]*sliderSubtitleCoefficient) + 'px',
				"margin-bottom": Math.round(window["slider_subtitle_" + index][3]*sliderSubtitleCoefficient) + 'px',
				"letter-spacing": Math.round(window["slider_subtitle_" + index][2]*sliderSubtitleCoefficientLetterSpacing) + 'px'
			});

			slideItem.find('.edgtf-slide-text').css({
				"font-size": Math.round(window["slider_text_" + index][0]*sliderTextCoefficient) + 'px',
				"line-height": Math.round(window["slider_text_" + index][1]*sliderTextCoefficient) + 'px',
				"letter-spacing": Math.round(window["slider_text_" + index][2]*sliderTextCoefficientLetterSpacing) + 'px'
			});

			slideItem.find('.edgtf-btn:eq(0)').css({
				"font-size": Math.round(window["slider_button1_" + index][0]*sliderButtonCoefficient) + 'px',
				"line-height": Math.round(window["slider_button1_" + index][1]*sliderButtonCoefficient) + 'px',
				"letter-spacing": Math.round(window["slider_button1_" + index][2]*sliderButtonCoefficient) + 'px',
				"padding-top": Math.round(window["slider_button1_" + index][3]*sliderButtonCoefficient) + 'px',
				"padding-bottom": Math.round(window["slider_button1_" + index][3]*sliderButtonCoefficient) + 'px',
				"padding-left": Math.round(window["slider_button1_" + index][4]*sliderButtonCoefficient) + 'px',
				//"padding-right": Math.round(window["slider_button1_" + index][4]*sliderButtonCoefficient) + 'px'
			});
			slideItem.find('.edgtf-btn:eq(0) .edgtf-btn-text').css({
				"padding-right": Math.round(window["slider_button1_" + index][4]*sliderButtonCoefficient) + 'px'
			});
			slideItem.find('.edgtf-btn:eq(1)').css({
				"font-size": Math.round(window["slider_button2_" + index][0]*sliderButtonCoefficient) + 'px',
				"line-height": Math.round(window["slider_button2_" + index][1]*sliderButtonCoefficient) + 'px',
				"letter-spacing": Math.round(window["slider_button2_" + index][2]*sliderButtonCoefficient) + 'px',
				"padding-top": Math.round(window["slider_button2_" + index][3]*sliderButtonCoefficient) + 'px',
				"padding-bottom": Math.round(window["slider_button2_" + index][3]*sliderButtonCoefficient) + 'px',
				"padding-left": Math.round(window["slider_button2_" + index][4]*sliderButtonCoefficient) + 'px',
				//"padding-right": Math.round(window["slider_button2_" + index][4]*sliderButtonCoefficient) + 'px'
			});
			slideItem.find('.edgtf-btn:eq(1) .edgtf-btn-text').css({
				"padding-right": Math.round(window["slider_button2_" + index][4]*sliderButtonCoefficient) + 'px'
			});


		}

		/**
		 * Set heights for slider and elemnts depending on slider settings (full height, responsive height od set height)
		 * @param slider, current slider
		 */
		var setHeights =  function(slider) {

			slider.find('.item').each(function (i) {
				setSizeGlobalVariablesForSlideElements($(this),i);
				setSliderElementsSize($(this), i, false);
			});

			if(slider.hasClass('edgtf-full-screen')){

				setSliderFullHeight(slider);

				$(window).resize(function() {
					setSliderElementsResponsiveCoeffeicients(responsiveBreakpointSet,coefficientsGraphicArray,coefficientsTitleArray,coefficientsSubtitleArray,coefficientsTextArray,coefficientsButtonArray);
					setSliderFullHeight(slider);
					slider.find('.item').each(function(i){
						setSliderElementsSize($(this), i, false);
					});
				});

			}else if(slider.hasClass('edgtf-responsive-height')){

				var defaultHeight = slider.data('height');
				setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, false);

				$(window).resize(function() {
					setSliderElementsResponsiveCoeffeicients(responsiveBreakpointSet,coefficientsGraphicArray,coefficientsTitleArray,coefficientsSubtitleArray,coefficientsTextArray,coefficientsButtonArray);
					setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, false);
					slider.find('.item').each(function(i){
						setSliderElementsSize($(this), i, false);
					});
				});

			}else {
				var defaultHeight = slider.data('height');

				slider.find('.edgtf-slider-preloader').css({'height': (slider.height()) + 'px'});
				slider.find('.edgtf-slider-preloader .edgtf-ajax-loader').css({'display': 'block'});

				edgtf.windowWidth < 1000 ? setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, false) : setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, true);

				$(window).resize(function() {
					setSliderElementsResponsiveCoeffeicients(responsiveBreakpointSet,coefficientsGraphicArray,coefficientsTitleArray,coefficientsSubtitleArray,coefficientsTextArray,coefficientsButtonArray);
					if(edgtf.windowWidth < 1000){
						setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, false);
						slider.find('.item').each(function(i){
							setSliderElementsSize($(this),i,false);
						});
					}else{
						setSliderHeight(slider, defaultHeight, responsiveBreakpointSet, true);
						slider.find('.item').each(function(i){
							setSliderElementsSize($(this),i,true);
						});
					}
				});
			}
		}

		/**
		 * Set prev/next numbers on navigation arrows
		 * @param slider, current slider
		 * @param currentItem, current slide item index
		 * @param totalItemCount, total number of slide items
		 */
		var setPrevNextNumbers = function(slider, currentItem, totalItemCount) {
			if(currentItem == 1){
				slider.find('.left.carousel-control .prev').html(totalItemCount);
				slider.find('.right.carousel-control .next').html(currentItem + 1);
			}else if(currentItem == totalItemCount){
				slider.find('.left.carousel-control .prev').html(currentItem - 1);
				slider.find('.right.carousel-control .next').html(1);
			}else{
				slider.find('.left.carousel-control .prev').html(currentItem - 1);
				slider.find('.right.carousel-control .next').html(currentItem + 1);
			}
		}

		/**
		 * Set video background size
		 * @param slider, current slider
		 */
		var initVideoBackgroundSize = function(slider){
			var min_w = 1500; // minimum video width allowed
			var video_width_original = 1920;  // original video dimensions
			var video_height_original = 1080;
			var vid_ratio = 1920/1080;

			slider.find('.item .edgtf-video .edgtf-video-wrap').each(function(){

				var slideWidth = edgtf.windowWidth;
				var slideHeight = $(this).closest('.carousel').height();

				$(this).width(slideWidth);

				min_w = vid_ratio * (slideHeight+20);
				$(this).height(slideHeight);

				var scale_h = slideWidth / video_width_original;
				var scale_v = (slideHeight - edgtfQuadricGlobalVars.vars.edgtfMenuAreaHeight) / video_height_original;
				var scale =  scale_v;
				if (scale_h > scale_v)
					scale =  scale_h;
				if (scale * video_width_original < min_w) {scale = min_w / video_width_original;}

				$(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * video_width_original +2));
				$(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * video_height_original +2));
				$(this).scrollLeft(($(this).find('video').width() - slideWidth) / 2);
				$(this).find('.mejs-overlay, .mejs-poster').scrollTop(($(this).find('video').height() - slideHeight) / 2);
				$(this).scrollTop(($(this).find('video').height() - slideHeight) / 2);
			});
		}

		/**
		 * Init video background
		 * @param slider, current slider
		 */
		var initVideoBackground = function(slider) {
			$('.item .edgtf-video-wrap .video').mediaelementplayer({
				enableKeyboard: false,
				iPadUseNativeControls: false,
				pauseOtherPlayers: false,
				// force iPhone's native controls
				iPhoneUseNativeControls: false,
				// force Android's native controls
				AndroidUseNativeControls: false
			});

			$(window).resize(function() {
				initVideoBackgroundSize(slider);
			});

			//mobile check
			if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/)){
				$('.edgtf-slider .edgtf-mobile-video-image').show();
				$('.edgtf-slider .edgtf-video-wrap').remove();
			}
		}

		/**
		 * Svg drawing
		 * @param slide, current slide
		 */

		//var initSvgDraw = function(slide) {
        //
		//	if(slide.find('.edgtf-slider-svg').length){
		//			var svg = slide.find('.edgtf-slider-svg');
		//			edgtf.modules.common.edgtfCheckSVG(svg);
		//			svg.css('opacity',1);
		//	}
        //
		//}
		/**
		 * initiate slider
		 * @param slider, current slider
		 * @param currentItem, current slide item index
		 * @param totalItemCount, total number of slide items
		 * @param slideAnimationTimeout, timeout for slide change
		 */
		var initiateSlider = function(slider, totalItemCount, slideAnimationTimeout) {

			//set active class on first item
			slider.find('.carousel-inner .item:first-child').addClass('active');
			//check for header style
			edgtfCheckSliderForHeaderStyle($('.carousel .active'), slider.hasClass('edgtf-header-effect'));
			// setting numbers on carousel controls
			if(slider.hasClass('edgtf-slider-numbers')) {
				setPrevNextNumbers(slider, 1, totalItemCount);
			}
			// set video background if there is video slide
			if(slider.find('.item video').length){
				initVideoBackgroundSize(slider);
				initVideoBackground(slider);
			}

			//draw svg
			//initSvgDraw(slider.find('.item.active'));

			//init slider
			if(slider.hasClass('edgtf-auto-start')){
				slider.carousel({
					interval: slideAnimationTimeout,
					pause: false
				});

				//pause slider when hover slider button
				slider.find('.slide_buttons_holder .qbutton')
					.mouseenter(function() {
						slider.carousel('pause');
					})
					.mouseleave(function() {
						slider.carousel('cycle');
					});
			} else {
				slider.carousel({
					interval: 0,
					pause: false
				});
			}


			//initiate image animation
			if($('.carousel-inner .item:first-child').hasClass('edgtf-animate-image') && edgtf.windowWidth > 1000){
				slider.find('.carousel-inner .item.edgtf-animate-image:first-child .edgtf-image').transformAnimate({
					transform: "matrix("+matrixArray[$('.carousel-inner .item:first-child').data('edgtf_animate_image')]+")",
					duration: 30000,
                    complete: function () {
                        $(this).transformAnimate({
                            transform: "matrix(1, 0, 0, 1, 0, 0)",
                            duration: 30000
                        });
                    }
				});
			}

		}

		return {
			init: function() {
				if(sliders.length) {
					sliders.each(function() {
						var $this = $(this);
						var slideAnimationTimeout = $this.data('slide_animation_timeout');
						var totalItemCount = $this.find('.item').length;
						if($this.data('edgtf_responsive_breakpoints')){
							if($this.data('edgtf_responsive_breakpoints') == 'set2'){
								responsiveBreakpointSet = [1600,1300,1000,768,567,320];
							}
						}
						coefficientsGraphicArray = $this.data('edgtf_responsive_graphic_coefficients').split(',');
						coefficientsTitleArray = $this.data('edgtf_responsive_title_coefficients').split(',');
						coefficientsSubtitleArray = $this.data('edgtf_responsive_subtitle_coefficients').split(',');
						coefficientsTextArray = $this.data('edgtf_responsive_text_coefficients').split(',');
						coefficientsButtonArray = $this.data('edgtf_responsive_button_coefficients').split(',');

						setSliderElementsResponsiveCoeffeicients(responsiveBreakpointSet,coefficientsGraphicArray,coefficientsTitleArray,coefficientsSubtitleArray,coefficientsTextArray,coefficientsButtonArray);

						setHeights($this);

						/*** wait until first video or image is loaded and than initiate slider - start ***/
						if(edgtf.htmlEl.hasClass('touch')){
							if($this.find('.item:first-child .edgtf-mobile-video-image').length > 0){
								var src = imageRegex.exec($this.find('.item:first-child .edgtf-mobile-video-image').attr('style'));
							}else{
								var src = imageRegex.exec($this.find('.item:first-child .edgtf-image').attr('style'));
							}
							if(src) {
								var backImg = new Image();
								backImg.src = src[1];
								$(backImg).on('load', function(){
									$('.edgtf-slider-preloader').fadeOut(500);
									initiateSlider($this,totalItemCount,slideAnimationTimeout);
								});
							}
						} else {
							if($this.find('.item:first-child video').length > 0){
								$this.find('.item:first-child video').get(0).addEventListener('loadeddata',function(){
									$('.edgtf-slider-preloader').fadeOut(500);
									initiateSlider($this,totalItemCount,slideAnimationTimeout);
								});
							}else{
								var src = imageRegex.exec($this.find('.item:first-child .edgtf-image').attr('style'));
								if (src) {
									var backImg = new Image();
									backImg.src = src[1];
									$(backImg).on('load', function(){
										$('.edgtf-slider-preloader').fadeOut(500);
										initiateSlider($this,totalItemCount,slideAnimationTimeout);
									});
								}
							}
						}
						/*** wait until first video or image is loaded and than initiate slider - end ***/

						$this.on('slide.bs.carousel', function () {
							$this.addClass('edgtf-in-progress');
							$this.find('.active .edgtf-slider-content-outer').fadeTo(250,0);
						});
						$this.on('slid.bs.carousel', function () {
							$this.removeClass('edgtf-in-progress');
							$this.find('.active .edgtf-slider-content-outer').fadeTo(0,1);

							//initSvgDraw($this.find('.item.active'));

							// setting numbers on carousel controls
							if($this.hasClass('edgtf-slider-numbers')) {
								var currentItem = $('.item').index($('.item.active')[0]) + 1;
								setPrevNextNumbers($this, currentItem, totalItemCount);
							}

							// initiate image animation on active slide and reset all others
							$('.item.edgtf-animate-image .edgtf-image').stop().css({'transform':'', '-webkit-transform':''});
							if($('.item.active').hasClass('edgtf-animate-image') && edgtf.windowWidth > 1000){
								$('.item.edgtf-animate-image.active .edgtf-image').transformAnimate({
									transform: "matrix("+matrixArray[$('.item.edgtf-animate-image.active').data('edgtf_animate_image')]+")",
									duration: 30000,
                                    complete: function () {
                                        $(this).transformAnimate({
                                            transform: "matrix(1, 0, 0, 1, 0, 0)",
                                            duration: 30000
                                        });
                                    }
								});
							}

						});

						/* after slide transition - end */

						/* swipe functionality - start */
						$this.swipe( {
							swipeLeft: function(){ $this.carousel('next'); },
							swipeRight: function(){ $this.carousel('prev'); },
							threshold:20
						});
						/* swipe functionality - end */

					});

                    //adding parallax functionality on slider
                    if($('.no-touch .carousel').length){
                        var skrollr_slider = skrollr.init({
                            smoothScrolling: false,
                            forceHeight: false
                        });
                        skrollr_slider.refresh();
                    }

                    $(window).scroll(function(){
                        //set control class for slider in order to change header style
                        if($('.edgtf-slider .carousel').height() < edgtf.scroll){
                            $('.edgtf-slider .carousel').addClass('edgtf-disable-slider-header-style-changing');
                        }else{
                            $('.edgtf-slider .carousel').removeClass('edgtf-disable-slider-header-style-changing');
                            edgtfCheckSliderForHeaderStyle($('.edgtf-slider .carousel .active'),$('.edgtf-slider .carousel').hasClass('edgtf-header-effect'));
                        }

                        //hide slider when it is out of viewport
                        if($('.edgtf-slider .carousel').hasClass('edgtf-full-screen') && edgtf.scroll > edgtf.windowHeight && edgtf.windowWidth > 1000){
                            $('.edgtf-slider .carousel').find('.carousel-inner, .carousel-indicators').hide();
                        }else if(!$('.edgtf-slider .carousel').hasClass('edgtf-full-screen') && edgtf.scroll > $('.edgtf-slider .carousel').height() && edgtf.windowWidth > 1000){
                            $('.edgtf-slider .carousel').find('.carousel-inner, .carousel-indicators').hide();
                        }else{
                            $('.edgtf-slider .carousel').find('.carousel-inner, .carousel-indicators').show();
                        }
                    });

				}

			}
		};
	};

	/**
	 * Check if slide effect on header style changing
	 * @param slide, current slide
	 * @param headerEffect, flag if slide
	 */

	function edgtfCheckSliderForHeaderStyle(slide, headerEffect) {

		if($('.edgtf-slider .carousel').not('.edgtf-disable-slider-header-style-changing').length > 0) {

			var slideHeaderStyle = "";
			if (slide.hasClass('light')) { slideHeaderStyle = 'edgtf-light-header'; }
			if (slide.hasClass('dark')) { slideHeaderStyle = 'edgtf-dark-header'; }

			if (slideHeaderStyle !== "") {
				if (headerEffect) {
					edgtf.body.removeClass('edgtf-dark-header edgtf-light-header').addClass(slideHeaderStyle);
				}
			} else {
				if (headerEffect) {
					edgtf.body.removeClass('edgtf-dark-header edgtf-light-header').addClass(edgtf.defaultHeaderStyle);
				}

			}
		}
	}

})(jQuery);
(function($) {
    'use strict';

    $(document).ready(function () {
        edgtfInitQuantityButtons();
        edgtfInitSelect2();
        edgtfAddedtoCartButton();
	    edgtfInitSingleProductLightbox();
    });

    function edgtfInitQuantityButtons() {

        $(document).on( 'click', '.edgtf-quantity-minus, .edgtf-quantity-plus', function(e) {
            e.stopPropagation();


            var button = $(this),
                inputField = button.siblings('.edgtf-quantity-input'),
                step = parseFloat(inputField.attr('step')),
                max = parseFloat(inputField.attr('max')),
                minus = false,
                inputValue = parseFloat(inputField.val()),
                newInputValue;

            if (button.hasClass('edgtf-quantity-minus')) {
                minus = true;
            }

            if (minus) {
                newInputValue = inputValue - step;
                if (newInputValue >= 1) {
                    inputField.val(newInputValue);
                } else {
                    inputField.val(1);
                }
            } else {
                newInputValue = inputValue + step;
                if ( max === undefined ) {
                    inputField.val(newInputValue);
                } else {
                    if ( newInputValue >= max ) {
                        inputField.val(max);
                    } else {
                        inputField.val(newInputValue);
                    }
                }
            }
             inputField.trigger( 'change' );
        });

    }

    function edgtfInitSelect2() {

        if ($('.woocommerce-ordering .orderby').length ||  $('#calc_shipping_country').length ||  $('.variations select').length ) {

            $('.woocommerce-ordering .orderby').select2({
                minimumResultsForSearch: Infinity
            });

            $('#calc_shipping_country').select2();
            $('.variations select').select2();

        }

    }

    function edgtfAddedtoCartButton(){
        $('body').on("added_to_cart", function( data ) {

        $('a.added_to_cart').addClass('edgtf-btn edgtf-btn-outline');

        });
    }

	/*
	 ** Init Product Single Pretty Photo attributes
	 */
	function edgtfInitSingleProductLightbox() {
		var item = $('.edgtf-woocommerce-single-page .edgtf-single-product-images .images .woocommerce-product-gallery__image');

		if(item.length) {
			item.each(function() {
				var thisItem = $(this).children('a');

				thisItem.attr('data-rel', 'prettyPhoto[woo_single_pretty_photo]');

				if (typeof edgtf.modules.common.edgtfPrettyPhoto === "function") {
					edgtf.modules.common.edgtfPrettyPhoto();
				}
			});
		}
	}

})(jQuery);
(function($) {
    'use strict';

    edgtf.modules.portfolio = {};

    $(window).on('load', function() {
        edgtfPortfolioSingleFollow().init();
    });

    var edgtfPortfolioSingleFollow = function() {

			var info = $('.edgtf-follow-portfolio-info .small-images.edgtf-portfolio-single-holder .edgtf-portfolio-info-holder, ' +
				'.edgtf-follow-portfolio-info .small-slider.edgtf-portfolio-single-holder .edgtf-portfolio-info-holder');

			if (info.length) {
				var infoHolder = info.parent(),
					infoHolderOffset = infoHolder.offset().top,
					infoHolderHeight = infoHolder.height(),
					mediaHolder = $('.edgtf-portfolio-media'),
					mediaHolderHeight = mediaHolder.height(),
					header = $('.header-appear, .edgtf-fixed-wrapper'),
					headerHeight = (header.length) ? header.height() : 0;
			}

			var infoHolderPosition = function() {

				if(info.length) {

					if (mediaHolderHeight > infoHolderHeight) {
						if(edgtf.scroll > infoHolderOffset) {
							info.animate({
								marginTop: (edgtf.scroll - (infoHolderOffset) + edgtfQuadricGlobalVars.vars.edgtfAddForAdminBar + headerHeight + 20) //20 px is for styling, spacing between header and info holder
							});
						}
					}

				}
			};

			var recalculateInfoHolderPosition = function() {

				if (info.length) {
					if(mediaHolderHeight > infoHolderHeight) {
						if(edgtf.scroll > infoHolderOffset) {

							if(edgtf.scroll + headerHeight + edgtfQuadricGlobalVars.vars.edgtfAddForAdminBar + infoHolderHeight + 20 < infoHolderOffset + mediaHolderHeight) {    //20 px is for styling, spacing between header and info holder

								//Calculate header height if header appears
								if ($('.header-appear, .edgtf-fixed-wrapper').length) {
									headerHeight = $('.header-appear, .edgtf-fixed-wrapper').height();
								}
								info.stop().animate({
									marginTop: (edgtf.scroll - (infoHolderOffset) + edgtfQuadricGlobalVars.vars.edgtfAddForAdminBar + headerHeight + 20) //20 px is for styling, spacing between header and info holder
								});
								//Reset header height
								headerHeight = 0;
							}
							else{
								info.stop().animate({
									marginTop: mediaHolderHeight - infoHolderHeight
								});
							}
						} else {
							info.stop().animate({
								marginTop: 0
							});
						}
					}
				}
			};

        return {

            init : function() {

                infoHolderPosition();
                $(window).scroll(function(){
                    recalculateInfoHolderPosition();
                });

            }

        };

    };

})(jQuery);


??

??