%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/shaban/laviva/wp-content/themes/levelup/assets/js/
Upload File :
Create Path :
Current File : /var/www/html/shaban/laviva/wp-content/themes/levelup/assets/js/default.js

var rdyGlobals = {};

rdyGlobals.isMobile	= (/(Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|windows phone)/.test(navigator.userAgent));
rdyGlobals.isAndroid = (/(Android)/.test(navigator.userAgent));
rdyGlobals.isiOS = (/(iPhone|iPod|iPad)/.test(navigator.userAgent));
rdyGlobals.isiPhone	= (/(iPhone|iPod)/.test(navigator.userAgent));
rdyGlobals.isiPad = (/(iPad)/.test(navigator.userAgent));
rdyGlobals.isBuggy = (navigator.userAgent.match(/AppleWebKit/) && typeof window.ontouchstart === 'undefined' && ! navigator.userAgent.match(/Chrome/));
rdyGlobals.isWindowsPhone = navigator.userAgent.match(/IEMobile/i);

if (rdyGlobals.isMobile) {
    document.documentElement.className += " mobile-true";
} else {
    document.documentElement.className += " mobile-false";
}

rdyGlobals.logoURL = false;
rdyGlobals.logoH = false;
rdyGlobals.logoW = false;
rdyGlobals.isHovering = false;


var $ = jQuery.noConflict();

(function($) {

    function is_touch_device() {
        return ('ontouchstart'in document.documentElement);
    }

    var setSkrollr = function($el, data) {
        for (var i = 0, l = data.length; i < l; i++) {
            var d = data[i],
                px = d[0];
            var css = d[1];
            $el.attr('data-' + px, css);
        }
    };

    $.fn.exists = function() {
        if ($(this).length > 0) {
            return true;
        } else {
            return false;
        }
    };


    $.fn.loaded = function(callback, jointCallback, ensureCallback){
        var len	= this.length;
        if (len > 0) {
            return this.each(function() {
                var	el		= this,
                    $el		= $(el),
                    blank	= "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==";

                $el.on("load.rdy", function(event) {
                    $(this).off("load.rdy");
                    if (typeof callback === "function") {
                        callback.call(this);
                    }
                    if (--len <= 0 && (typeof jointCallback === "function")){
                        jointCallback.call(this);
                    }
                });

                if (!el.complete || el.complete === undefined) {
                    el.src = el.src;
                } else {
                    $el.trigger("load.rdy");
                }
            });
        } else if (ensureCallback) {
            if (typeof jointCallback === "function") {
                jointCallback.call(this);
            }
            return this;
        }
    };


    window.isDesktop = !0;


    /**
     *  VC vc_rowBehaviour Rewrite
     */

    window.vc_rowBehaviour = function () {
        var $ = window.jQuery;

        function parallaxRow() {
            var parallaxRows = new Array();
            var speedDivider = 0.25;
            var bodyTop = document.documentElement.scrollTop || document.body.scrollTop;
            var wwidth = window.innerWidth || document.documentElement.clientWidth;
            var wheight = window.innerHeight || document.documentElement.clientHeight;

            var skrollrSpeed, skrollrSize, skrollrStart, skrollrEnd, $parallaxElement, parallaxImage, youtubeId;

            $(".vc_parallax-inner").remove();
            $(".vc_parallax[data-vc-parallax]").each(function () {
                if ("on" === $(this).data("vcParallaxOFade")) {
                    $(this).children('.row-container').children('.row-inner').attr("data-5p-top-bottom", "opacity:0;").attr("data-50p-top-bottom", "opacity:1;");
                }

                var $parallaxElement = $("<div/>").addClass("vc_parallax-inner").appendTo($(this));
                parallaxImage = $(this).data("vcParallaxImage");
                youtubeId = vcExtractYoutubeId(parallaxImage);
                if (youtubeId) {
                    insertYoutubeVideoAsBackground($parallaxElement, youtubeId);
                } else if("undefined" !== typeof parallaxImage) {
                    $parallaxElement.css("background-image", "url(" + parallaxImage + ")");
                }

                parallaxRows.push($parallaxElement);
            });

            setParallaxOffset = function(el, valueY) {
                var translate = 'translate3d(0, ' + valueY + 'px' + ', 0)';
                el.css({
                    '-webkit-transform': translate,
                    '-moz-transform': translate,
                    '-ms-transform': translate,
                    '-o-transform': translate,
                    'transform': translate
                });
            };

            parallaxRowCol = function(bodyTop) {
                var offsetValue;
                if (typeof parallaxRows === 'object') {
                    for (var i = 0; i < parallaxRows.length; i++) {
                        var parallaxRow = parallaxRows[i];
                        var holder = parallaxRows[i].parent(),

                            thisHeight = parallaxRow.outerHeight(),
                            sectionHeight = holder.outerHeight(),
                            offSetTop = bodyTop + (holder !== null ? holder.get(0).getBoundingClientRect().top : 0),
                            offSetPosition = wheight + bodyTop - offSetTop;

                        if (offSetPosition > 0 && offSetPosition < (sectionHeight + wheight)) {
                            offsetValue = ((offSetPosition - wheight) * speedDivider);

                            if (Math.abs(offsetValue) < (thisHeight - sectionHeight)) {
                                setParallaxOffset(parallaxRow, offsetValue);
                            } else {
                                setParallaxOffset(parallaxRow, thisHeight - sectionHeight);
                            }
                        }
                    }
                }
            };

            scrollFunction = function() {
                // if (logoel != undefined && logoel.length) shrinkMenu(bodyTop);
                // if (menusticky != undefined && menusticky.length && !isMobile) stickMenu(bodyTop);
                // if (!isMobile) hideMenu(bodyTop);
                // if (header && menusticky != undefined && menusticky.length) switchColorsMenu(bodyTop);
                parallaxRowCol(bodyTop);
                // parallaxHeader(bodyTop);
                // headerOpacity(bodyTop);
            };

            window.addEventListener('scroll', function(e) {
                bodyTop = document.documentElement.scrollTop || document.body.scrollTop;
                // if (wwidth > mediaQuery && !isMobile) {
                scrollFunction();
                // }
                // showHideScrollup(bodyTop);
            }, false);

            parallaxRowCol(bodyTop);

            if (window.skrollr) {
                vcSkrollrOptions = {
                    forceHeight: !1,
                    smoothScrolling: !1,
                    mobileCheck: function () {
                        return false;
                    }
                }
                window.vcParallaxSkroll = skrollr.init(vcSkrollrOptions)
            }

            /*var skrollrSpeed, skrollrSize, skrollrStart, skrollrEnd, $parallaxElement, parallaxImage, youtubeId;

            $(".vc_parallax-inner").remove();
            $(".vc_parallax[data-vc-parallax]").each(function () {
                var $parallaxElement = $("<div style='height: 100%' />").addClass("vc_parallax-inner").appendTo($(this));
                parallaxImage = $(this).data("vcParallaxImage");
                youtubeId = vcExtractYoutubeId(parallaxImage);
                if (youtubeId) {
                    insertYoutubeVideoAsBackground($parallaxElement, youtubeId);
                } else if("undefined" !== typeof parallaxImage) {
                    //$parallaxElement.css("background-image", "url(" + parallaxImage + ")");
                }

                $parallaxElement.parallax({speed: 0.2, imageSrc: parallaxImage});
            });*/




            /*var vcSkrollrOptions, callSkrollInit = !1;
            return window.vcParallaxSkroll && window.vcParallaxSkroll.destroy(),
                $(".vc_parallax-inner").remove(),
                $("[data-5p-top-bottom]").removeAttr("data-5p-top-bottom data-30p-top-bottom"),
                $("[data-vc-parallax]").each(function () {
                    var skrollrSpeed, skrollrSize, skrollrStart, skrollrEnd, $parallaxElement, parallaxImage, youtubeId;
                    callSkrollInit = !0,
                    "on" === $(this).data("vcParallaxOFade") && $(this).children('.row-container').children('.row-inner').attr("data-5p-top-bottom", "opacity:0;").attr("data-30p-top-bottom", "opacity:1;"),
                    skrollrSize = 100 * 1.3;//$(this).data("vcParallax"),
                    $parallaxElement = $("<div />").addClass("vc_parallax-inner").appendTo($(this)),
                    $parallaxElement.height(skrollrSize + "%"),
                    parallaxImage = $(this).data("vcParallaxImage"),
                    youtubeId = vcExtractYoutubeId(parallaxImage),
                    youtubeId ? insertYoutubeVideoAsBackground($parallaxElement, youtubeId) : "undefined" !== typeof parallaxImage && $parallaxElement.css("background-image", "url(" + parallaxImage + ")"),
                    skrollrSpeed = skrollrSize - 100,
                    skrollrStart = -skrollrSpeed,
                    skrollrEnd = 0,
                    $parallaxElement.attr("data-bottom-top", "top: " + skrollrStart + "%;").attr("data-top-bottom", "top: " + skrollrEnd + "%;");
                }),

                //window.skrollr ? skrollr.get().refresh()
                callSkrollInit && window.skrollr ? (vcSkrollrOptions = {
                    forceHeight: !1,
                    smoothScrolling: !1,
                    mobileCheck: function () {
                        return false;
                    }
                },
                window.vcParallaxSkroll = skrollr.init(vcSkrollrOptions), window.vcParallaxSkroll

                ) : !1;
*/

        }

        function fullHeightRow() {
            var $element = $(".vc_row-o-full-height:first");
            if ($element.length) {
                var $window, windowHeight, offsetTop, fullHeight;
                $window = $(window);
                windowHeight = $window.height();
                offsetTop = $element.offset().top;

                if (windowHeight > offsetTop) {
                    fullHeight = 100 - offsetTop / (windowHeight / 100);
                    $element.css("min-height", fullHeight + "vh");
                }
            }
            $(document).trigger("vc-full-height-row", $element);
        }

        // VC-mod
        function rdyFixIeFlexbox() {
            var ua = window.navigator.userAgent, msie = ua.indexOf("MSIE ");
            if (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) {
                $(".rdy_vc_row-o-full-height").each(function () {
                    $(this).addClass('rdy_vc_ie-flexbox-fixer');
                });
            }

            if (msie > 0 || navigator.userAgent.match(/Trident.*rv\:11\./)) {
                $(".rdy_vc_row-o-equal-height > .row-container > .row-inner").each(function () {
                    if("flex" === $(this).css("display")) {
                        $(this).find('.vc_column-inner > .wpb_wrapper').addClass('rdy_vc_ie-flexbox-fixer-h');
                    }
                });
            }
        }

        $(window).off("resize.vcRowBehaviour"); fullHeightRow(); rdyFixIeFlexbox(); vc_initVideoBackgroundsYV(); parallaxRow();

    };

    /**
     *  END ## VC vc_rowBehaviour Rewrite
     */


    function vcExtractVimeoId(url) {
        if ("undefined" == typeof url)return !1;
        var id = url.match(/(http|https)?:\/\/(www\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^\/]*)\/videos\/|)(\d+)(?:|\/\?)/);
        return null !== id && id[4];
    }

    function vc_initVideoBackgroundsYV() {
        jQuery("[data-vc-video-bg]").each(function () {
            var youtubeUrl,
                youtubeId,
                $element = jQuery(this);

            $element.data("vcVideoBg") ? (
                youtubeUrl = $element.data("vcVideoBg"),
                    youtubeId = vcExtractYoutubeId(youtubeUrl),
                    vimeoId = vcExtractVimeoId(youtubeUrl),
                youtubeId && (
                    $element.find(".vc_video-bg").remove(),
                        insertYoutubeVideoAsBackground($element, youtubeId)
                ),
                vimeoId && (
                    $element.find(".vc_video-bg").remove(),
                        insertVimeoVideoAsBackground($element, vimeoId)
                ),
                jQuery(window).on("grid:items:added", function (event, $grid) {
                    $element.has($grid).length && vcResizeVideoBackground($element);
                })
            ) :
                $element.find(".vc_video-bg").remove();
        });
    }

    function insertVimeoVideoAsBackground($element, vimeoId, counter) {
        var $container = $element.prepend('<div class="vc_video-bg vc_hidden-xs"><div class="inner"><iframe src="https://player.vimeo.com/video/' + vimeoId + '?wmode=opaque&background=1&api=1&autoplay=1&loop=1&player_id=video_' + vimeoId + '&title=0&byline=0&portrait=0&color=" id="video_' + vimeoId + '" width="640" height="320" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div></div>').find(".inner");
        $element.data('provider', 'vimeo');

        var player = $f($element.find('iframe')[0]);
        player.addEvent('ready', function() {
            player.api('setVolume', 0);
        });

        vcResizeVideoBackground($element), jQuery(window).bind("resize", function () {
            vcResizeVideoBackground($element);
        });
    }

    jQuery(".wpb_tour_tabs_wrapper").on( "tabsactivate tabsshow", function( event, ui ) {
        var panel = ui.panel || ui.newPanel;
        var $iso = panel.find(".iso-container, .products.products-grid:not(.owl-carousel)");

        $iso.length && $iso.each(function () {
            jQuery(this).isotope("layout");
        });
    } );

    jQuery(".wpb_accordion_wrapper").on( "accordionactivate accordionchange", function( event, ui ) {
        var panel = ui.panel || ui.newPanel;
        panel.find(".iso-container").length && panel.find(".iso-container").each(function () {
            jQuery(this).isotope("layout");
        });
    } );


    function vcResizeVideoBackground($element) {
        var iframeW,
            iframeH,
            marginLeft,
            marginTop,
            containerW = $element.innerWidth(),
            containerH = $element.innerHeight(),
            ratio1 = 16,
            ratio2 = 9,
            a = 5;

        ratio = ratio1 / ratio2;
        controls_remove = 50;

        if(containerW / containerH < ratio1 / ratio2) {
            iframeW = containerH * (ratio1 / ratio2);
            iframeH = containerH;
            // marginLeft = -Math.round((iframeW - containerW) / 2) + "px",
            // marginTop = -Math.round((iframeH - containerH) / 2) + "px",
            // iframeW += "px",
            // iframeH += "px"
        } else {
            iframeW = containerW;
            iframeH = containerW * (ratio2 / ratio1);
        }

        if($element.data('provider') == 'vimeo'){
            iframeH = iframeH + controls_remove * 2;
            iframeW = ratio * iframeH;
        }

        marginTop = -Math.round((iframeH - containerH) / 2) + "px";
        marginLeft = -Math.round((iframeW - containerW) / 2) + "px";
        iframeW += "px";
        iframeH += "px";

        $element.find(".vc_video-bg iframe").css({
            maxWidth: "1000%",
            marginLeft: marginLeft,
            marginTop: marginTop,
            width: iframeW,
            height: iframeH
        });

    }


    $(window).load(function () {

        initNavigationBar();
        rdy.can.init();

        $('.rev_slider_wrapper').each(function(){
            var $this = jQuery(this),
                id_array = $this.attr("id").split("_"),
                id = id_array[2];

            if (id != undefined && id != '') {

                $this.bind("revolution.slide.onloaded", function (e,data) {
                    var style = jQuery(e.currentTarget).find("li").eq(0).attr("data-skin");
                    if (style != undefined) {
                        $('.columns-project').data('slider-nav-color', style);
                        $('.columns-project').removeClass('slider-nav-color-dark').addClass('slider-nav-color-' + style );
                    }
                });
                $this.bind("revolution.slide.onbeforeswap", function (e,data) {
                    var style = data.nextslide.attr("data-skin");
                    if (style != undefined) {
                        $('.columns-project').data('slider-nav-color', style);
                        $('.columns-project').removeClass('slider-nav-color-dark').addClass('slider-nav-color-' + style );
                    }
                });

            }
        });

    });


    jQuery(document).ready(function($) {


        /*function initContent(){
            var scrollbarWidth,
                windowWidth = window.innerWidth || document.documentElement.clientWidth;

            // initContent
            if (!rdyGlobals.isMobile && scrollbarWidth == undefined) {
                // Create the measurement node
                var scrollDiv = document.createElement("div");
                scrollDiv.className = "scrollbar-measure";
                var dombody = document.body;
                if (dombody != null) {
                    dombody.appendChild(scrollDiv);
                    // Get the scrollbar width
                    scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
                    // Delete the DIV
                    dombody.removeChild(scrollDiv);
                }
            }
            if (!rdyGlobals.isMobile) {
                $('.site-content').each(function(i, el) {
                    var boxLeft;
                    var boxWidth;
                    var el = $(this);

                    var elWidth = el.outerWidth(),
                        newWidth = 12 * Math.ceil((windowWidth - scrollbarWidth) / 12);
                    boxWidth = newWidth;
                    boxLeft = Math.ceil(((newWidth) - windowWidth) / 2);
                    el.css({ width: boxWidth + 'px', marginLeft: '-' + (boxLeft + (scrollbarWidth / 2)) + 'px' })
                });
            }
        }

        initContent();

        window.addEventListener("resize", function() {
            initContent();
        });*/


        if (rdyGlobals.isMobile && $("rdy-portfolio-container .rdy_portfolio[data-top-bottom]").length) {
            $("rdy-portfolio-container .rdy_portfolio").removeAttr("data-top-bottom data-bottom");
        }


        if ($(".variations select").length) {
            $(".variations select").select2({
                allowClear: true,
                minimumResultsForSearch: -1,
                width: 'style',
                dropdownAutoWidth : true,
                dropdownCssClass: "woo-orderby-dropdown"
            });
        }

        if ($(".woocommerce .orderby").length) {
            $(".orderby").select2({
                allowClear: true,
                minimumResultsForSearch: -1,
                width: 'style',
                dropdownAutoWidth : true,
                dropdownCssClass: "woo-orderby-dropdown"
            });
        }

        if ($(".woocommerce-page.single-product").length) {

            if ($('#woo-images1.owl-carousel').length) {

                var sync1 = $("#woo-images1");
                var sync2 = $("#woo-images2");
                var flag = false;

                var slides = sync1.owlCarousel({
                    autoHeight: !1,
                    dots: !1,
                    nav: !0,
                    navText: ['<i class="gi gi-arrow-left"></i>','<i class="gi gi-arrow-right"></i>'],

                    items: 1,
                    loop: false
                }).on('change.owl.carousel', function(e) {
                    if (e.namespace && e.property.name === 'position' && !flag) {
                        flag = true;
                        sync2
                            .find(".owl-item")
                            .removeClass("synced")
                            .eq(e.relatedTarget.relative(e.property.value))
                            .addClass("synced");
                        sync2.trigger('to.owl.carousel', [e.relatedTarget.relative(e.property.value), 300, true]);
                        flag = false;
                    }
                }).data('owl.carousel');

                var thumbs = sync2.owlCarousel({
                    items : 4,
                    nav: false,
                    dots: !1
                }).on('click', '.owl-item', function(e) {
                    e.preventDefault();
                    sync1.trigger('to.owl.carousel', [$(e.target).parents('.owl-item').index(), 300, true]);
                }).on('change.owl.carousel', function(e) {
                }).data('owl.carousel');
            }


            $("#woo-images1 a").magnificPopup({
                type: "image",
                mainClass: 'mfp-zoom-in',
                gallery: {enabled: !0},
                tLoading: '',
                closeBtnInside: false,
                closeMarkup: '<button title="%title%" type="button" class="mfp-close"></button>',
                removalDelay: 400
            });


            $(document).on( 'found_variation', 'form.cart', function( event, variation ) {
                var $product            = $('.product');
                var $product_img = $product.find( '.images .product-big-image .active img:eq(0)' ),
                    $product_link = $product.find( '.images .product-big-image a.zoom:eq(0)' ),
                    o_src = $product_img.attr( 'data-o_src' ),
                    o_title = $product_img.attr( 'data-o_title' ),
                    o_alt = $product_img.attr( 'data-o_alt' ),
                    o_href = $product_link.attr( 'data-o_href' ),
                    variation_image = variation.image.src,
                    variation_link  = variation.image.full_src,
                    variation_caption = variation.image.caption,
                    variation_title = variation.image.title;

                sync1.trigger("to.owl.carousel", [0, 1, true]);
                sync2.trigger("to.owl.carousel", [0, 1, true]);

                if ( variation_image && variation_image.length > 1 ) {
                    $product_img
                        .attr( 'src', variation_image )
                        .attr( 'alt', variation_title )
                        .attr( 'title', variation_title );
                    $product_link
                        .attr( 'href', variation_link )
                        .attr( 'title', variation_caption );
                } else {
                    $product_img
                        .attr( 'src', o_src )
                        .attr( 'alt', o_alt )
                        .attr( 'title', o_title );
                    $product_link
                        .attr( 'href', o_href )
                        .attr( 'title', o_title );
                }
            });
        }

        if (jQuery('header#header-menu.slidedown-full-layout').length) {

            if (jQuery('header#header-menu.slidedown-full-layout .widget-area').length && !jQuery('header#header-menu.slidedown-full-layout .main-area.widget-right').length ) {
                jQuery('header#header-menu #main-menu').css('padding-bottom', jQuery('header#header-menu.slidedown-full-layout .widget-area').outerHeight() + 40);
            }

            jQuery('#main-menu li:not(.menu-item-has-children) > a').on('click', function (e) {
                // if($(this).attr('href').indexOf("#") === 0) {
                menu_click_evnt();
                // }
            });

            jQuery('#main-menu li.menu-item-has-children > a').on('click', function(e){
                e.preventDefault();

                var $this = $(this),
                    $content = $this.closest('.menu-item').find('> ul.sub-menu');

                if ($this.hasClass("opened")) {
                    // TweenMax.to($content, 0.3, {height: 0});
                    // $content.velocity({opacity: 0}, {
                    //     duration: 300
                    // });
                    // $content.slideUp();
                    $content.velocity("slideUp", { duration: 200 });
                    // .velocity("slideDown", { duration: 1500 })


                    $content.removeClass("opened");
                    $this.removeClass("opened");
                } else {
                    var $elem_to_close;
                    // jQuery('#main-menu ul.sub-menu.opened').each(function(){
                    //     $elem_to_close = $(this);
                    // });

                    if ($elem_to_close) {
                        // TweenMax.to($elem_to_close, 0.3, {height: 0, onComplete: function () {
                        //     TweenMax.set($content, {height: "auto"});
                        //     TweenMax.from($content, 0.3, {height: 0});
                        //     $content.addClass("opened");
                        //     $this.addClass("opened");
                        // }});

                        // $elem_to_close.velocity({}, {
                        //     duration: 300,
                        //     complete: function () {
                        //         // $content.velocity({opacity: 1}, {
                        //         //     duration: 300
                        //         // });
                        //
                        //         $content.addClass("opened");
                        //         $this.addClass("opened");
                        //     }
                        // });
                        // $elem_to_close.slideUp();
                        // $content.slideDown();
                        $elem_to_close.velocity("slideUp", { duration: 200 });
                        $content.velocity("slideDown", { duration: 200 });

                        $content.addClass("opened");
                        $this.addClass("opened");


                        jQuery('#main-menu ul.sub-menu.opened').removeClass("opened");
                        jQuery('#main-menu ul.sub-menu.opened').closest('.menu-item').find('> a').removeClass("opened");
                    } else {
                        // TweenMax.set($content, {height: "auto", 'opacity': 1});
                        // TweenMax.from($content, 0.3, {height: 0});

                        // $content.slideDown();
                        $content.velocity("slideDown", { duration: 200 });
                        // $content.velocity({opacity: 1}, {
                        //     duration: 300
                        // });

                        $content.addClass("opened");
                        $this.addClass("opened");
                    }
                }
            });

        } else {
            jQuery('ul.sf-menu').superfish({
                onBeforeShow: function () {
                    var $this = $(this);
                    var obj = $this.parent('.menu-depth-0');
                    var left_offset;

                    if (obj.length) {
                        left_offset = obj.offset().left;
                    }

                    var right_offset = $(window).width() - $this.width() - left_offset;

                    if (obj.hasClass('wide')) {
                        if (right_offset < 0) {
                            var mm_center = ($(window).width() - $this.width()) / 2;
                            var mm_pos = left_offset - mm_center;
                            jQuery(this).css('width', $this.width());
                            jQuery(this).css('left', '-' + (mm_pos) + 'px');
                        } else {
                            jQuery(this).css('left', '0');
                        }
                    } else {
                        if (right_offset < 0) {
                            jQuery(this).css('left', '-' + ($this.width() - obj.width()) + 'px');
                        }
                    }
                }
            });
        }



        var rdy_header_menu = jQuery('#header-menu'),
            rdy_mobile_menu = jQuery('#mobile-menu'),
            rdy_header_search = jQuery('#header-search');

        var rdy_background_appear = jQuery('#header').data('background-appear');
        var rdy_background_color = jQuery('#header').data('background-color');
        var rdy_menu_items_color = jQuery('#header').data('items-color');
        var rdy_header_line_appear = jQuery('#header').data('line-appear');
        var rdy_header_shadow_appear = jQuery('#header').data('shadow-appear');

        function rdy_background_appear_scroll(){
            if ($(window).scrollTop() > rdy_background_appear) {
                rdy_header_menu.css({'background-color': rdy_background_color});
                if (rdy_menu_items_color) {
                    jQuery('#header, #header-menu').removeClass('mark-' + rdy_menu_items_color + ' mark-logo-' + rdy_menu_items_color);
                }
                if (rdy_header_line_appear) {
                    rdy_header_menu.addClass('show_bottomline');
                }
                if (rdy_header_shadow_appear) {
                    rdy_header_menu.addClass('with-shadow');
                }
            }
            else {
                rdy_header_menu.css('background-color', 'transparent');
                if (rdy_menu_items_color) {
                    jQuery('#header, #header-menu').addClass('mark-' + rdy_menu_items_color + ' mark-logo-' + rdy_menu_items_color);
                }
                if (rdy_header_line_appear) {
                    rdy_header_menu.removeClass('show_bottomline');
                }
                if (rdy_header_shadow_appear) {
                    rdy_header_menu.removeClass('with-shadow');
                }
            }
        }

        if (rdy_background_appear > 0) {
            $(window).scroll(function () {
                rdy_background_appear_scroll();
            });

            jQuery('#header-menu').css('background-color', 'transparent');
            if (rdy_menu_items_color) {
                jQuery('#header, #header-menu').addClass('mark-' + rdy_menu_items_color + ' mark-logo-' + rdy_menu_items_color);
            }

            $(window).load(function () {
                rdy_background_appear_scroll();
            });
        }


        var rdy_cta1 = jQuery('#header-menu .cta-button-1'),
            rdy_cta2 = jQuery('#header-menu .cta-button-2'),
            rdy_cta3 = jQuery('#header-menu .cta-button-3');

        var rdy_cta1_appear = rdy_cta1.data('cta-appear');
        var rdy_cta2_appear = rdy_cta2.data('cta-appear');
        var rdy_cta3_appear = rdy_cta3.data('cta-appear');

        function rdy_cta1_appear_scroll(el, appear){
            if ($(window).scrollTop() > appear) {
                el.addClass('cta_appear');
            } else {
                el.removeClass('cta_appear');
            }
        }

        if (rdy_cta1_appear > 0 || rdy_cta2_appear > 0 || rdy_cta3_appear > 0 ) {

            $(window).scroll(function () {
                if(rdy_cta1_appear){
                    rdy_cta1_appear_scroll(rdy_cta1, rdy_cta1_appear);
                }

                if(rdy_cta2_appear){
                    rdy_cta1_appear_scroll(rdy_cta2, rdy_cta2_appear);
                }
                if(rdy_cta3_appear){
                    rdy_cta1_appear_scroll(rdy_cta3, rdy_cta3_appear);
                }
            });

            $(window).load(function () {
                rdy_cta1_appear_scroll(rdy_cta1);

                if(rdy_cta2_appear){
                    rdy_cta1_appear_scroll(rdy_cta2, rdy_cta2_appear);
                }
                if(rdy_cta3_appear){
                    rdy_cta1_appear_scroll(rdy_cta3, rdy_cta3_appear);
                }
            });
        }


        function menu_click_evnt(e) {

            jQuery('#header').toggleClass('menu-opened');
            rdy_header_menu.toggleClass('menu-opened');

            if (jQuery('html').hasClass('popup_menu_opened')) {
                jQuery('html').removeClass('popup_menu_opened');
            } else {
                jQuery('html').addClass('popup_menu_opened');
            }

            if (rdy_header_menu.hasClass('slidedown-layout')) {
                if (rdy_header_menu.hasClass('menu-opened')) {
                    jQuery('.body-overlay[data-menu="1"]').show(0).fadeTo("fast", 1);

                    rdy_header_menu.velocity("stop");
                    rdy_header_menu.css({clip: 'rect(0px ' + $(window).width() + 'px 0px 0px)'});
                    rdy_header_menu.velocity({clipBottom: rdy_header_menu.height() + 6}, {
                        duration: 700,
                        easing: [0.19, 1, 0.22, 1],
                        complete: function () {
                            rdy_header_menu.css({clip: 'auto'});
                        }
                    });

                } else {
                    rdy_header_menu.velocity("stop");
                    rdy_header_menu.css({clip: 'rect(0px ' + $(window).width() + 'px ' + (rdy_header_menu.height() + 6) + 'px 0px)'});
                    jQuery('.body-overlay[data-menu="1"]').fadeTo("fast", 0, function () {
                        $(this).hide(0);
                    });

                    setTimeout(function () {
                        rdy_header_menu.velocity({clipBottom: 0}, {
                            duration: 800,
                            easing: [0.19, 1, 0.22, 1],
                            queue: false,
                            complete: function () {
                            }
                        });
                    }, 0);

                }
            }

            if ($(window).width() <= 992) {

                jQuery('#mobile-menu').css('padding-top', jQuery('#header').height() + jQuery('#header').position().top + 10);

                // if (jQuery('#mobile-menu.valign-middle.valign-el-bottom').length) {
                //     jQuery('#menu-mobile').css('margin-bottom', jQuery('#mobile-menu .mobile_menu_side').height());
                // }

                var animation = {translateY: "-110%"};
                var animation_out = {translateY:  [ "0%", "-110%" ]};

                if (rdy_mobile_menu.data('menu-animation') === 'slideleft') {
                    animation = {translateX: "-110%"};
                    animation_out = {translateX: ["0%", "-110%"]};
                } else if(rdy_mobile_menu.data('menu-animation') === 'slideright') {
                    animation = {translateX: "110%"};
                    animation_out = {translateX: ["0%", "110%"]};
                } else if(rdy_mobile_menu.data('menu-animation') === 'fadein') {
                    animation = {opacity: "0"};
                    animation_out = {opacity: ["1", "0"]};
                }


                if (rdy_mobile_menu.hasClass('menu-opened')) {
                    $('html').removeClass('no-scroll');

                    if (rdy_mobile_menu.data('menu-items-animation')) {
                        $('.menu-mobile > li, .mobile_socials, #mobile-search', rdy_mobile_menu).velocity("stop").velocity({opacity: 0});
                    }

                    rdy_mobile_menu.velocity("stop").velocity(animation, {
                        duration: 800,
                        easing: [0.19, 1, 0.22, 1],
                        complete: function () {
                            rdy_mobile_menu.css({visibility: 'hidden'});
                        }
                    });
                    rdy_mobile_menu.removeClass('menu-opened');

                    $('.body-overlay').fadeTo("fast", 0, function () {
                        $(this).hide(0);
                    });

                } else {
                    $('html').addClass('no-scroll');

                    rdy_mobile_menu.css({visibility: 'visible'}).velocity("stop").velocity(animation_out, {
                        duration: 900,
                        easing: [0.19, 1, 0.22, 1],
                        queue: false,
                        complete: function () {
                        }
                    });

                    if($('.body-overlay').length === 0) {
                        $('#totop').after('<div class="body-overlay"></div>');
                        jQuery('.body-overlay').click(function (e) {
                            menu_click_evnt();
                        });
                    }
                    $('.body-overlay').show(0).fadeTo("fast", 1);
                    if (rdy_mobile_menu.data('menu-animation') === 'slideleft' || rdy_mobile_menu.data('menu-animation') === 'slideright') {
                        jQuery('.body-overlay').addClass('upper');
                    }

                    rdy_mobile_menu.addClass('menu-opened');

                    var items_animation = '';

                    if (rdy_mobile_menu.data('menu-items-animation') === 'slideleft') {
                        items_animation = 'transition.slideLeftIn';
                    } else if (rdy_mobile_menu.data('menu-items-animation') === 'slideright') {
                        items_animation = 'transition.slideRightIn';
                    } else if (rdy_mobile_menu.data('menu-items-animation') === 'slideup') {
                        items_animation = 'transition.slideUpIn';
                    } else if (rdy_mobile_menu.data('menu-items-animation') === 'slidedown') {
                        items_animation = 'transition.slideDownIn';
                    } else if (rdy_mobile_menu.data('menu-items-animation') === 'fadein') {
                        items_animation = 'transition.fadeIn';
                    }

                    if (items_animation) {
                        $('.cta-button, .menu-mobile > li, .mobile_socials, #mobile-search', rdy_mobile_menu).velocity(items_animation, {
                            delay: 200,
                            stagger: rdy_mobile_menu.data('menu-items-cascade') ? 150 : false,
                            duration: 1000,
                            easing: "ease-in",
                            // complete: function () {
                            //     $('.mobile_menu_side', rdy_mobile_menu).velocity(items_animation, {
                            //         duration: 400,
                            //         easing: "ease-in"
                            //     });
                            // }
                        });
                    }

                }

            }

            if (rdy_header_menu.hasClass('slidedown-full-layout')) {
                var menu_full = jQuery('#header-menu.slidedown-full-layout #main-menu');
                if(jQuery('html').hasClass('popup_menu_opened')){
                    menu_full.delay(100).velocity({
                        opacity: [1, 0]
                    }, 900);
                }else{
                    menu_full.velocity("stop");
                    menu_full.css({'opacity': 0});
                }
            }

            if (e) {
                e.preventDefault();
            }
        }


        $("#mobile-menu li:not('.menu-item-has-children') a").on('click', function(m){

            menu_click_evnt();

        });


        function search_click_evnt(e) {
            jQuery('#header').toggleClass('search-opened');
            rdy_header_search.toggleClass('search-opened');

            if (jQuery('html').hasClass('popup_search_opened')) {
                jQuery('html').removeClass('popup_search_opened');
                rdy_header_search.velocity({translateY: '-' + (rdy_header_search.height() + 2)}, {
                    duration: 500,
                    easing: [0.19, 1, 0.22, 1],
                    complete: function () {
                        $(this).css({'display': 'none'});
                    }
                });
                jQuery('.body-overlay[data-search="1"]').fadeTo("fast", 0, function () {
                    $(this).hide(0);
                });

            } else {
                jQuery('html').addClass('popup_search_opened');
                rdy_header_search.velocity({translateY: [0, '-' + rdy_header_search.height()]}, {
                    duration: 400,
                    display: 'block',
                    easing: [0.19, 1, 0.22, 1],
                    complete: function () {}
                });
                jQuery('.body-overlay[data-search="1"]').show(0).fadeTo("fast", 1, function() {
                    $('input.search-field').focus();
                });

            }

            if (e) {
                e.preventDefault();
            }
        }

        if (rdy_header_menu.hasClass('slidedown-layout')) {
            rdy_header_menu.css({clip: 'rect(0px ' + $(window).width() + 'px 0px 0px)'});
        }

        jQuery('.hamburger-icon, .close_arrow').click(menu_click_evnt);
        jQuery('.search-icon, #header-search .search-close-icon').click(search_click_evnt);

        jQuery('.body-overlay').click(function (e) {
            if (jQuery('html').hasClass('popup_search_opened')) {
                search_click_evnt();
            }

            if (jQuery('html').hasClass('popup_menu_opened')) {
                menu_click_evnt();
            }
        });


        $('.cart-icon').click(function () {
            window.location.href = $(this).data('cart-url');
        });


        $(".no-touch .cart-icon").on("mouseenter", function () {

            if (!$(this).data('init')) {
                $(this).data('init', true);
                var that = jQuery(this);

                jQuery(this).hoverIntent({
                    over: function () {
                        that.find(jQuery('.rdy_minicart_wrapper')).css('z-index', 9999).slideDown(150).show(0);
                        if (!rdyGlobals.isMobile) {
                            $(this).addClass('hover');
                        }
                    },
                    out: function () {
                        that.find(jQuery('.rdy_minicart_wrapper')).css('z-index', 0).slideUp(150);
                        if (!rdyGlobals.isMobile) {
                            $(this).removeClass('hover');
                        }
                    },

                    timeout: 150,
                    interval: 0
                });
                $(this).trigger('mouseenter');
            }
        });


        if (rdyGlobals.isWindowsPhone) {
            $("body").addClass("ie-mobile");
        }


        function doAnimation() {
            //if ($( window ).width() > 992) {
                var $animation_param = {duration: 300, easing: "easeInOut"};

                $(".anm-arrow-left-hv").each(function () {
                    $(this).mouseenter(function() {
                        $(this).velocity("stop").velocity({translateX: -10}, $animation_param);

                        if (!$(this).hasClass('anm-arrow-mout')) {
                           $(this).velocity({translateX: 0}, $animation_param);
                        }
                    });

                    if ($(this).hasClass('anm-arrow-mout')) {
                        $(this).mouseleave(function() {
                            $(this).velocity("stop").velocity({translateX: 0}, $animation_param);
                        });
                    }
                });
                $(".anm-arrow-right-hv").each(function () {
                    $(this).mouseenter(function() {
                        $(this).velocity("stop").velocity({translateX: 10}, $animation_param);

                        if (!$(this).hasClass('anm-arrow-mout')) {
                            $(this).velocity({translateX: 0}, $animation_param);
                        }
                    });

                    if ($(this).hasClass('anm-arrow-mout')) {
                        $(this).mouseleave(function() {
                            $(this).velocity("stop").velocity({translateX: 0}, $animation_param);
                        });
                    }
                });
                $(".anm-arrow-up-hv").each(function () {
                    $(this).mouseenter(function() {
                        $(this).velocity("stop").velocity({translateY: -10}, $animation_param);

                        if (!$(this).hasClass('anm-arrow-mout')) {
                            $(this).velocity({translateY: 0}, $animation_param);
                        }
                    });

                    if ($(this).hasClass('anm-arrow-mout')) {
                        $(this).mouseleave(function() {
                            $(this).velocity("stop").velocity({translateY: 0}, $animation_param);
                        });
                    }
                });

                $(".anm-arrow-down-hv").each(function () {
                    $(this).mouseenter(function() {
                        $(this).velocity("stop").velocity({translateY: 10}, $animation_param);

                        if (!$(this).hasClass('anm-arrow-mout')) {
                            $(this).velocity({translateY: 0}, $animation_param);
                        }
                    });

                    if ($(this).hasClass('anm-arrow-mout')) {
                        $(this).mouseleave(function() {
                            $(this).velocity("stop").velocity({translateY: 0}, $animation_param);
                        });
                    }
                });

                $(".animate-element:not(.start-animation):not(.client-logo)").each(function () {
                    var $this = $(this);

                    $(this).waypoint(function(direction) {
                        if (direction === 'down' && $this.data('animation-class')) {
                            if (!$this.hasClass("start-animation") && !$this.hasClass("animation-triggered")) {
                                $this.addClass("animation-triggered");

                                $this.addClass($this.data('animation-class'));
                                $this.addClass("start-animation animated");
                                $this.css("opacity", "1");
                            }
                        }

                    }, { offset: '100%' });


                    if($(this).hasClass('animate-loop')){
                        $(this).waypoint(function(direction) {
                            if (direction === 'up' && $this.data('animation-class') && $this.hasClass("start-animation")) {
                                $this.removeClass($this.data('animation-class'));
                                $this.removeClass("start-animation animated animation-triggered");
                                $this.css("opacity", "0");
                            }

                        }, { offset: '110%' });
                    }
                });

                $(".rdy-clients-shortcode.with-animation-fadein:not(.is-hover)").each(function () {
                    var $this = $(this);
                    var repeatOnce = true;

                    if ($this.hasClass('animate-loop')) {
                        repeatOnce = false;
                    }

                    $(this).waypoint(function(direction) {
                        if (direction === 'down') {
                            var delay = 0;
                            $this.find('.client-logo').each(function () {
                                $(this).velocity("stop").velocity({opacity: 1}, {
                                    duration: 300,
                                    delay: delay
                                });
                                delay = delay + 300;
                            });

                        }

                    }, { offset: '95%', triggerOnce: repeatOnce });

                    if($this.hasClass('animate-loop')){
                        $(this).waypoint(function(direction) {
                            if (direction === 'up') {
                                $this.find('.client-logo').velocity("stop").css({'opacity': 0});
                            }

                        }, { offset: '110%', triggerOnce: repeatOnce });
                    }

                });


                $(".vc_custom_heading[data-text-animate]").each(function () {
                    var $this = $(this);

                    $(this).waypoint(function(direction) {
                        if (direction === 'down' && !$this.hasClass('text-animation-triggered')) {
                            var delay = 0;

                            if ( $this.data('text-animate-delay') ) {
                                delay = $this.data('text-animate-delay');
                            }

                            var $animation = "transition.fadeIn";

                            if ($this.data('text-animate-type') === 'fadeIn') {
                                $animation = "transition.fadeIn";
                            }
                            else if ($this.data('text-animate-type') === 'slideUpIn') {
                                $animation = "transition.slideUpIn";
                            }

                            var $text_animation_param;

                            if ($this.data('text-animate') === 'char') {
                                $text_animation_param = {
                                    stagger: 250, duration: 550
                                };

                                if ( $this.data('text-animate-speed') === 'fast' ) {
                                    $text_animation_param = {
                                        stagger: 100, duration: 200
                                    };
                                } else if ( $this.data('text-animate-speed') === 'middle' ) {
                                    $text_animation_param = {
                                        stagger: 160, duration: 300
                                    };
                                }

                                $this.find('span').blast({delimiter: "word"});

                                setTimeout(function () {
                                    $this.addClass('text-animation-triggered');
                                    $this.find('.blast-root span.blast').each(function(){
                                        $(this).removeClass('blast');
                                        $(this).blast({ delimiter: "char", tag: "em" });
                                    });
                                    $this.find('.blast-root em.blast').velocity($animation, $text_animation_param);
                                }, delay);
                            }
                            else if($this.data('text-animate') === 'word')
                            {
                                $text_animation_param = {
                                    stagger: 800, duration: 1000
                                };

                                if ( $this.data('text-animate-speed') === 'fast' ) {
                                    $text_animation_param = {
                                        stagger: 250, duration: 500
                                    };
                                } else if ( $this.data('text-animate-speed') === 'middle' ) {
                                    $text_animation_param = {
                                        stagger: 400, duration: 600
                                    };
                                }

                                setTimeout(function () {
                                    $this.addClass('text-animation-triggered');
                                    $this.find('span').blast({delimiter: "word"}).velocity($animation, $text_animation_param);
                                }, delay);

                            }

                        }

                    }, { offset: '100%' });

                });

            /*} else {
                $(".rdy-clients-shortcode.with-animation-fadein:not(.is-hover)").each(function () {
                    $(this).find('.client-logo').velocity("stop").css('opacity', 1);
                });
            }*/

        }

        function doAnimationAlt() {
            if ($( window ).width() > 992) {
                $(".rdy_separator.animate:not(.start-animation)").each(function () {
                    var $this = $(this);
                    var repeatOnce = true;
                    if($this.hasClass('animate-loop')){
                        repeatOnce = false;
                    }

                    $(this).waypoint(function(direction) {

                        if(direction === 'down' && !$this.hasClass("animation-triggered")) {
                            var delay = $this.data('animation-delay') ? $this.data('animation-delay') : 0;

                            if (!$this.hasClass("start-animation") && !$this.hasClass("animation-triggered")) {
                                $this.addClass("animation-triggered");

                                setTimeout(function () {
                                    $this.addClass($this.data('animation-class'));
                                    $this.addClass("start-animation");
                                }, delay);
                            }

                        }

                    }, { offset: '90%', triggerOnce: repeatOnce });

                    if($this.hasClass('animate-loop')) {
                        $(this).waypoint(function (direction) {
                            if (direction === 'up') {
                                $this.removeClass("animation-triggered");
                                $this.removeClass("start-animation");
                            }

                        }, {offset: '110%', triggerOnce: repeatOnce});
                    }
                });
            }
        }

        if (!$("html").hasClass("old-ie")) {
            rdyGlobals.isPhone = false;
            rdyGlobals.isTablet = false;
            rdyGlobals.isDesktop = false;

            var size = window.getComputedStyle(document.body, ":after").getPropertyValue("content");

            if (size.indexOf("phone") !== -1 && rdyGlobals.isMobile) {
                rdyGlobals.isPhone = true;
            } else if (size.indexOf("tablet") !== -1 && rdyGlobals.isMobile) {
                rdyGlobals.isTablet = true;
            } else {
                rdyGlobals.isDesktop = true;
            }

            setTimeout(function () {
                doAnimation();
                doAnimationAlt();
            }, 50);

            if (!rdyGlobals.isMobile && !$("html").hasClass("old-ie")) {
                $(window).on("scroll", function () {
                    doAnimationAlt();
                });
            }
        }


        var rdyResizeTimeout;
        if (rdyGlobals.isMobile && !rdyGlobals.isWindowsPhone) {
            $(window).bind("orientationchange", function (event) {
                clearTimeout(rdyResizeTimeout);
                rdyResizeTimeout = setTimeout(function () {
                    $(window).trigger("debouncedresize");
                }, 200);

            });
        } else {
            $(window).on("resize", function () {
                clearTimeout(rdyResizeTimeout);
                rdyResizeTimeout = setTimeout(function () {
                    $(window).trigger("debouncedresize");
                }, 200);
            });
        }

        $('#mobile-menu .container ul li').each(function(){
            if($(this).find('> ul').length > 0) {
                $(this).addClass('has-ul');
                $(this).find('> a > span').append('<div class="fa-sub-indicator"><i class="fa fa-angle-down"></i></div>');
            }
        });

        $('#mobile-menu .container ul li:has(">ul") > a .fa-sub-indicator').click(function(){
            $(this).parent().parent().parent().toggleClass('open');
            $(this).parent().parent().parent().find('> ul').stop(true,true).slideToggle();
            return false;
        });
        $('#mobile-menu .container ul li.expand:has(">ul") > a').click(function(){
            $(this).parent().toggleClass('open');
            $(this).parent().find('> ul').stop(true,true).slideToggle();
            return false;
        });


        if(!rdyGlobals.isMobile && window.skrollr){
            var s = skrollr.init({
                smoothScrolling: false,
                forceHeight: false,
                mobileCheck: function () {
                    return false;
                }
            });
            s.refresh();

            $(window).resize(function() {
                s.refresh();
            });
        }


        $('body:not(.post-type-archive-rdy_project)').on('click','.section-down-arrow',function(){
            var $offset = $('.fancy-header').height() - $('.fancy-header').offset().top;

            if($(window).width() < 992){
                $offset = $offset + 60;
            }/*else if($('#header').data('background-appear') && $('#header-menu.fixed-layout').length && !$('#header-menu.with-background').length){
                $offset = $offset - $('#header-menu').height();
            }*/

            $('.fancy-header').velocity("stop").velocity('scroll', {
                duration: 1000,
                offset: $offset + 2,
                easing: 'easeInOutCubic'
            });
        });


        var rdy_limit_height;
        var rdy_topbar_height = 0;
        var rdy_has_stiky_mobile = $("#header").hasClass('stiky-mobile');

        function rdy_header_scroll() {

            var isMobileResolution = window.innerWidth <= 992 ? true : false;

            if ( !$('body.with-slide-topbar').length && !isMobileResolution ) {
                return false;
            }

            if ($('#top-bar').exists() && $('#top-bar').css('display') !== 'none') {
                rdy_topbar_height = $('#top-bar').innerHeight();
            } else {
                rdy_topbar_height = 0;
            }

            rdy_limit_height = rdy_topbar_height;

            var rdy_window_y = $(window).scrollTop();
            var wpadminbar_height = 0;
            var top_margin = 0;

            if($("#wpadminbar").exists()){
                wpadminbar_height = top_margin = $("#wpadminbar").height();
                // rdy_limit_height = rdy_limit_height;
            }

            if (rdy_window_y > rdy_limit_height && !isMobileResolution) {
                if (!$("#header").hasClass("m-fixed")) {
                    $("#header, #header-menu").addClass("m-fixed").css({"top": top_margin});
                }

            } else if (rdy_has_stiky_mobile && wpadminbar_height && rdy_window_y > wpadminbar_height && window.innerWidth <= 600 ) {
                $("#header").addClass("m-fixed").css("top", 0, 'important');
                $("#mobile-menu").addClass("m-fixed").css("top", 0, 'important');

            } else if (rdy_has_stiky_mobile && wpadminbar_height && rdy_window_y < wpadminbar_height && window.innerWidth <= 600 ) {
                $("#header").removeClass("m-fixed").css({"top": "auto"});
                $("#mobile-menu").removeClass("m-fixed").css({"top": "auto"});

            } else {
                if ($("#header").hasClass("m-fixed")) {
                    $("#header, #header-menu").removeClass("m-fixed").css({"top": "auto"});
                }
            }

            if ($(window).width() <= 992) {
                $("#mobile-menu").css('max-height', $(window).height());
            }
        }


        rdy_header_scroll();
        var debounce_header_resize = debounce(function () {
            rdy_header_scroll();
        }, 100);
        window.addEventListener("resize", debounce_header_resize);

        var rdy_mobile_scroll_visible = false;
        $(window).scroll(function () {
            if ($(this).scrollTop() > 50) {
                $('.section-down-arrow').addClass('hidden');
            } else {
                $('.section-down-arrow').removeClass('hidden');
            }

            if ($(window).width() > 992) {
                if ($(this).scrollTop() > 500) {
                    $('.scroll-top-main').css('display', 'block').fadeIn(500);
                } else {
                    $('.scroll-top-main').fadeOut(500);
                }

            } else {
                if ($(this).scrollTop() > 300 && ( $('#bottom-bar').length ? $(document).height() - $(window).height() - $('#bottom-bar').height() > $(window).scrollTop() : true) ) {
                    if (!rdy_mobile_scroll_visible) {
                        rdy_mobile_scroll_visible = true;
                        $('.scroll-top-main-mobile').velocity("stop").velocity({translateY: 0}, {
                            duration: 150,
                            easing: [0.19, 1, 0.22, 1],
                            queue: false,
                            complete: function () {
                            }
                        });
                    }

                } else {
                    if (rdy_mobile_scroll_visible) {
                        rdy_mobile_scroll_visible = false;
                        $('.scroll-top-main-mobile').velocity("stop").velocity({translateY: 60}, {
                            duration: 140,
                            easing: [0.19, 1, 0.22, 1],
                            queue: false,
                            complete: function () {
                            }
                        });
                    }
                }
            }
            rdy_header_scroll();
        });

        var midnight_default_height = $('#wpadminbar').length ? 70 : 140;
        $('header#header').midnight({
            otherObjects: '#header-menu',
            otherObjectHeight: $('header#header-menu.slidedown-full-layout').length ? midnight_default_height : false
        });

        $(".scroll-top, .scroll-top-main, .scroll-top-main-mobile").click(function(e) {
            e.preventDefault();
            $("html, body").animate({scrollTop: 0}, {duration: 900, easing: "easeInOutExpo"});
            return false;
        });

        $(".scroll-top").mouseenter(function() {
            $(this).find('.icon').velocity("stop").velocity({translateY: -10, opacity:0.7}, {
                duration: 250, easing: "easeInOut"
            }).velocity({translateY: 0, opacity:1}, {
                duration: 250, easing: "easeInOut"
            });
        });


        if($('body.animated-anchors').length && typeof $('#header-menu a').smoothScroll === 'function'){
            // if(!$('#header-menu.slidedown-full-layout').length){
                $('#header-menu a, #menu-mobile a').smoothScroll({speed: 1000, easing: "easeInOutCubic", animationEngine: 'velocity'});
            // }

            $('.rdy_button, .rev_slider a, .wpb_single_image a, .vc_icon_element a, .wpb_text_column a, .b_icon_with_title a, .vc_column_link, .vc_custom_heading a, .vc_btn3, .vc_icon_element-link, .b_icon_list a').smoothScroll({speed: 1000, easing: "easeInOutCubic", animationEngine: 'velocity'});
        }

        $('#header-menu.slidedown-full-layout').mousewheel(function(event, delta) {
            this.scrollTop -= (delta * 30);
            event.preventDefault();
        });

        var min_w = 1200; // minimum video width allowed
        var vid_w_orig;  // original video dimensions
        var vid_h_orig;

        vid_w_orig = 1280;
        vid_h_orig = 720;


        function resizeVideoToCover() {
            $('.vc_row > video').each(function(){

                var container = $(this).parent('.vc_row'),
                    video = $(this);

                var width = container.outerWidth(),
                    height = container.outerHeight(),
                    pWidth,
                    pHeight,
                    ratio = 1.777777,
                    heightOffset = 0,
                    widthOffset = heightOffset * ratio;

                if (container.data('video-ratio')) {
                    ratio = container.data('video-ratio');
                }

                if (width / ratio < height) {
                    pWidth = Math.ceil((height + heightOffset) * ratio);
                    video.css({
                        width: pWidth + widthOffset + 'px',
                        height: height + heightOffset + 'px',
                        left: ((width - pWidth) / 2) - (widthOffset / 2) + 'px',
                        top: '-' + (heightOffset / 2) + 'px'
                    });

                } else {
                    pHeight = Math.ceil(width / ratio);
                    video.css({
                        width: width + widthOffset + 'px',
                        height: pHeight + heightOffset + 'px',
                        left: '-' + (widthOffset / 2) + 'px',
                        top: ((height - pHeight) / 2) - (heightOffset / 2) + 'px'
                    });

                }

                if (!video.data('show')) {
                    video.css('opacity', 1);
                }

            });

            $('.site-content.project .illustrations-container .illustrations .illustration-inner[data-video="1"]').each(function(i){
                var $containerHeight;
                var $containerWidth;
                var $container = $('.mejs-container', $(this));

                if($(this).parents('#page-header-bg').length > 0) {
                    if($('.container-wrap.auto-height').length > 0) {
                        return false;
                    }
                    $containerHeight = $(this).parents('#page-header-bg').outerHeight();
                    $containerWidth = $(this).parents('#page-header-bg').outerWidth();
                } else if($(this).parents('.illustration').length > 0) {
                    if($('.container-wrap.auto-height').length > 0) {
                        return false;
                    }
                    $containerHeight = $(this).parents('.illustration').outerHeight();
                    $containerWidth = $(this).parents('.illustration').outerWidth();
                } else {
                    $containerHeight = $(this).parents('.wpb_row').outerHeight();
                    $containerWidth = $(this).parents('.wpb_row').outerWidth();
                }

                $container.width($containerWidth);
                $container.height($containerHeight);

                var scale_h = $containerWidth / vid_w_orig;
                var scale_v = ($containerHeight - $containerHeight) / vid_h_orig;
                var scale = scale_h > scale_v ? scale_h : scale_v;

                min_w = 1280/720 * ($containerHeight+40);

                if (scale * vid_w_orig < min_w) {scale = min_w / vid_w_orig;}

                $(this).find('video, .mejs-overlay, .mejs-poster').width(Math.ceil(scale * vid_w_orig +0));
                $(this).find('video, .mejs-overlay, .mejs-poster').height(Math.ceil(scale * vid_h_orig +0));

                $container.css('left', -($(this).find('video').width() - $containerWidth) / 2);
                $container.css('top', -($(this).find('video').height() - ($containerHeight)) / 2);

            });
        }

        setTimeout(function () {
            resizeVideoToCover();
        }, 300);

        jQuery(window).resize(function () {
            resizeVideoToCover();
        });


        $('.vc_progress_bar:not(.open)').waypoint(function () {
            var $bar = $(this);
            setTimeout(function () {
                $bar.addClass('open');
            }, 500);

        }, { offset:'85%' });


        function initUncovering() {
            if ($('body.footer-uncovering').length) {
                if ($(window).width() >= 992) {
                    $('#page').css('margin-bottom', $('footer.site-footer').height());
                } else {
                    $('#page').css('margin-bottom', 0);
                }
            }
        }

        $(window).on('debouncedresize', function() {
            initUncovering();
        });
        initUncovering();


        if ($('.wpcf7-form.style-3').length) {
            $('body').on('focus', '.wpcf7-form.style-3 input, .wpcf7-form.style-3 textarea', function () {
                $(this).parents('.action-form-input').addClass('filled').removeClass('no-text');
            });

            $('body').on('blur','.wpcf7-form.style-3 input, .wpcf7-form.style-3 textarea',function(){
                if($(this).val().length > 0) $(this).parents('.wpcf7-form-control-wrap').addClass('has-text').removeClass('no-text');
                else $(this).parents('.wpcf7-form-control-wrap').removeClass('has-text').addClass('no-text');

                if (!($(this).val().length > 0)) {
                    $(this).parents('.action-form-input').removeClass('filled');
                }
            });
        }

        function convertToActionStyle(el){

            $(el).each(function(){
                if($(this).parent().find('input:not([type="checkbox"]):not([type="hidden"]):not(#search-outer input):not(.adminbar-input):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="date"]):not([type="color"]):not([type="range"]):not([role="button"]):not([role="combobox"]):not(.select2-focusser):not([name="min_price"]):not([name="max_price"])').length == 1 || $(this).parent().find('textarea').length == 1) {

                    if($(this).parents('.action-form-input').length == 0) {
                        if($(this).next('input').length == 1) {

                            $(this).next('input').andSelf().wrapAll('<div class="action-form-input"/>');
                        } else if($(this).find('.wpcf7-form-control-wrap').length > 0) {
                            var $cloneInput = $(this).find('.wpcf7-form-control-wrap');
                            $(this).find('.wpcf7-form-control-wrap').remove();
                            $cloneInput.insertAfter($(this));
                            $(this).parent().wrapInner('<div class="action-form-input" />');
                        } else {
                            $(this).parent().wrapInner('<div class="action-form-input" />');
                        }
                        $html = $(this).html();
                        $(this)[0].innerHTML = '<span class="text"><span class="text-inner">'+$html+'</span></span>';

                        if($(this).parent().find('textarea').length == 1) $(this).parents('.action-form-input').addClass('textarea');
                    }
                }

            });

            $(el).each(function(){
                if($(this).parents('.action-form-input').length == 1 && $(this).find('.text').length == 0) {
                    $html = $(this).html();
                    $(this)[0].innerHTML = '<span class="text"><span class="text-inner">'+$html+'</span></span>';
                }
            });
        }

        setTimeout(function(){ convertToActionStyle('form.wpcf7-form label'); removeExcessLabels(); checkValueOnLoad(); }, 501);

        function removeExcessLabels() {
            $('.action-form-input').each(function(){
                if($(this).find('label').length > 1) {
                    $lngth = 0;
                    $(this).find('label').each(function(){
                        if($(this).text().length >= $lngth) {
                            $lngth = $(this).text().length;
                            $(this).parents('.action-form-input').find('label').addClass('tbr');
                            $(this).removeClass('tbr');
                        }
                    });
                    $(this).find('label.tbr').remove();
                }
            });
        }
        removeExcessLabels();


        function checkValueOnLoad() {
            $('.action-form-input input, .action-form-input textarea').each(function(){
                if($(this).val().length > 0) $(this).parents('.action-form-input').addClass('has-text').removeClass('no-text');
            });
        }
        checkValueOnLoad();



        function scrollSpyInit(){

            var $headerNavSpace = ($('#header-menu[data-fixed-menu="1"]').length > 0 && $(window).width() > 1000) ? $('#header-menu').outerHeight() : 0;

            /*
            //remove full page URLs from hash if located on same page to fix current menu class
            //if(location.pathname.length > 1) {
            $("#header-outer a[href*='" + location.pathname + "']").each(function(){
                var $href = $(this).attr('href');

                //regular animated anchors
                if($href.indexOf("#") != -1 && $('div'+$href.substr($href.indexOf("#"))).length > 0 ) {

                    $(this).attr('href',$href.substr($href.indexOf("#")));
                    $(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
                }

                //fullpage is a little different
                if($('div[data-fullscreen-anchor-id="'+$href.substr($href.indexOf("#")+1)+'"]').length > 0) {
                    $(this).parent().removeClass('current_page_item').removeClass('current-menu-item');
                }

            });*/
            //}
            var adminBarHeight = ($('#wpadminbar').length > 0) ? $('#wpadminbar').height() : 0; //admin bar

            $target = '#header-menu'; //($('.page-submenu[data-sticky="true"]').length == 0) ? '#header-outer nav': '.page-submenu';
            $('body').scrollspy({
                target: $target,
                offset: $headerNavSpace + adminBarHeight + 40 //130 + 32
            });

        }


        initClientList();
        initOwlSlider();
        initResponsiveVideoIframesInit();
        initFullScreenHeader();
        initParallax();
        initToCounter();
        initCounterRandom();
        initCounterMotion();
        initPieChart();
        initMessages();
        initRdyListAnimation();
        initPortfolioListAnimation();
        initWoocommerce();
        initWoocommerceSpinner();
        initJsHeight();
        magnificPopup();
        initSVGiconAnimation();
        initShare();
        // if($('body.animated-anchors').length > 0) setTimeout(scrollSpyInit,200);

        //initInfiniteScroll();
        jQuery( document.body ).on( 'updated_cart_totals', function() { initWoocommerceSpinner(); } );

        if (jQuery.fn.isotope !== undefined) {
            rdy.isotopeLayout();
        }

        rdy.fxGrainOverlay();
        rdy.fxGlitchOverlay();
        rdy.cascadeAnimation();

        if($.fn.rdyCountdown) {
            $('.rdy-countdown-timer').rdyCountdown();
        }


        var $smoothActive = $('body').attr('data-smooth-scrolling');
        var $smoothCache = ( $smoothActive == 1 ) ? true : false;

        if($smoothCache == false && navigator.platform.toUpperCase().indexOf('MAC') === -1 && !navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|Opera Mini)/) && $(window).width() > 690) {
            /*var scroll = new SmoothScroll('a[href*="#"]', {
                speed: 500,
                speedAsDuration: true
            });*/
            /*!function(){function e(){var e=!1;e&&c("keydown",r),v.keyboardSupport&&!e&&u("keydown",r)}function t(){if(document.body){var t=document.body,n=document.documentElement,o=window.innerHeight,r=t.scrollHeight;if(S=document.compatMode.indexOf("CSS")>=0?n:t,w=t,e(),x=!0,top!=self)y=!0;else if(r>o&&(t.offsetHeight<=o||n.offsetHeight<=o)){var a=!1,i=function(){a||n.scrollHeight==document.height||(a=!0,setTimeout(function(){n.style.height=document.height+"px",a=!1},500))};if(n.style.height="auto",setTimeout(i,10),S.offsetHeight<=o){var l=document.createElement("div");l.style.clear="both",t.appendChild(l)}}v.fixedBackground||b||(t.style.backgroundAttachment="scroll",n.style.backgroundAttachment="scroll")}}function n(e,t,n,o){if(o||(o=1e3),d(t,n),1!=v.accelerationMax){var r=+new Date,a=r-C;if(a<v.accelerationDelta){var i=(1+30/a)/2;i>1&&(i=Math.min(i,v.accelerationMax),t*=i,n*=i)}C=+new Date}if(M.push({x:t,y:n,lastX:0>t?.99:-.99,lastY:0>n?.99:-.99,start:+new Date}),!T){var l=e===document.body,u=function(){for(var r=+new Date,a=0,i=0,c=0;c<M.length;c++){var s=M[c],d=r-s.start,f=d>=v.animationTime,h=f?1:d/v.animationTime;v.pulseAlgorithm&&(h=p(h));var m=s.x*h-s.lastX>>0,w=s.y*h-s.lastY>>0;a+=m,i+=w,s.lastX+=m,s.lastY+=w,f&&(M.splice(c,1),c--)}l?window.scrollBy(a,i):(a&&(e.scrollLeft+=a),i&&(e.scrollTop+=i)),t||n||(M=[]),M.length?N(u,e,o/v.frameRate+1):T=!1};N(u,e,0),T=!0}}function o(e){x||t();var o=e.target,r=l(o);if(!r||e.defaultPrevented||s(w,"embed")||s(o,"embed")&&/\.pdf/i.test(o.src))return!0;var a=e.wheelDeltaX||0,i=e.wheelDeltaY||0;return a||i||(i=e.wheelDelta||0),!v.touchpadSupport&&f(i)?!0:(Math.abs(a)>1.2&&(a*=v.stepSize/120),Math.abs(i)>1.2&&(i*=v.stepSize/120),n(r,-a,-i),void e.preventDefault())}function r(e){var t=e.target,o=e.ctrlKey||e.altKey||e.metaKey||e.shiftKey&&e.keyCode!==H.spacebar;if(/input|textarea|select|embed/i.test(t.nodeName)||t.isContentEditable||e.defaultPrevented||o)return!0;if(s(t,"button")&&e.keyCode===H.spacebar)return!0;var r,a=0,i=0,u=l(w),c=u.clientHeight;switch(u==document.body&&(c=window.innerHeight),e.keyCode){case H.up:i=-v.arrowScroll;break;case H.down:i=v.arrowScroll;break;case H.spacebar:r=e.shiftKey?1:-1,i=-r*c*.9;break;case H.pageup:i=.9*-c;break;case H.pagedown:i=.9*c;break;case H.home:i=-u.scrollTop;break;case H.end:var d=u.scrollHeight-u.scrollTop-c;i=d>0?d+10:0;break;case H.left:a=-v.arrowScroll;break;case H.right:a=v.arrowScroll;break;default:return!0}n(u,a,i),e.preventDefault()}function a(e){w=e.target}function i(e,t){for(var n=e.length;n--;)E[A(e[n])]=t;return t}function l(e){var t=[],n=S.scrollHeight;do{var o=E[A(e)];if(o)return i(t,o);if(t.push(e),n===e.scrollHeight){if(!y||S.clientHeight+10<n)return i(t,document.body)}else if(e.clientHeight+10<e.scrollHeight&&(overflow=getComputedStyle(e,"").getPropertyValue("overflow-y"),"scroll"===overflow||"auto"===overflow))return i(t,e)}while(e=e.parentNode)}function u(e,t,n){window.addEventListener(e,t,n||!1)}function c(e,t,n){window.removeEventListener(e,t,n||!1)}function s(e,t){return(e.nodeName||"").toLowerCase()===t.toLowerCase()}function d(e,t){e=e>0?1:-1,t=t>0?1:-1,(k.x!==e||k.y!==t)&&(k.x=e,k.y=t,M=[],C=0)}function f(e){if(e){e=Math.abs(e),D.push(e),D.shift(),clearTimeout(z);var t=h(D[0],120)&&h(D[1],120)&&h(D[2],120);return!t}}function h(e,t){return Math.floor(e/t)==e/t}function m(e){var t,n,o;return e*=v.pulseScale,1>e?t=e-(1-Math.exp(-e)):(n=Math.exp(-1),e-=1,o=1-Math.exp(-e),t=n+o*(1-n)),t*v.pulseNormalize}function p(e){return e>=1?1:0>=e?0:(1==v.pulseNormalize&&(v.pulseNormalize/=m(1)),m(e))}var w,g={frameRate:150,animationTime:500,stepSize:120,pulseAlgorithm:!0,pulseScale:8,pulseNormalize:1,accelerationDelta:20,accelerationMax:1,keyboardSupport:!0,arrowScroll:50,touchpadSupport:!0,fixedBackground:!0,excluded:""},v=g,b=!1,y=!1,k={x:0,y:0},x=!1,S=document.documentElement,D=[120,120,120],H={left:37,up:38,right:39,down:40,spacebar:32,pageup:33,pagedown:34,end:35,home:36},v=g,M=[],T=!1,C=+new Date,E={};setInterval(function(){E={}},1e4);var z,A=function(){var e=0;return function(t){return t.uniqueID||(t.uniqueID=e++)}}(),N=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(e,t,n){window.setTimeout(e,n||1e3/60)}}(),K=/chrome/i.test(window.navigator.userAgent),L=null;"onwheel"in document.createElement("div")?L="wheel":"onmousewheel"in document.createElement("div")&&(L="mousewheel"),L&&K&&(u(L,o),u("mousedown",a),u("load",t))}();*/
        }

    });


    jQuery(document).ready(function () {

        // Retina images using srcset polyfill
        window.retinizer = function() {
            if ($("body").hasClass("srcset-enabled")) {
                var $coll = $("img:not(.retinized)").filter("[srcset]"),
                    ratio = window.devicePixelRatio ? window.devicePixelRatio : 1;

                $coll.each(function() {
                    var $this = $(this),
                        srcArray = $this.attr("srcset").split(","),
                        srcMap = [],
                        src = "";

                    srcArray.forEach(function(el, i) {
                        var temp = $.trim(el).split(" ");
                        srcMap[temp[1]] = temp[0];
                    });

                    if (ratio >= 1.5) {
                        if (!(typeof srcMap["2x"] == "undefined")) src = srcMap["2x"];
                        else src = srcMap["1x"];
                    }
                    else {
                        if (!(typeof srcMap["1x"] == "undefined")) src = srcMap["1x"];
                        else src = srcMap["2x"];
                    }

                    $this.attr("src", src).addClass("retinized");
                });

                // Retina logo in floating menu
                if (! (typeof rdyGlobals.logoURL == "undefined")) {
                    var logoArray = rdyGlobals.logoURL.split(","),
                        logoMap = [];

                    logoArray.forEach(function (el, i) {
                        var temp = $.trim(el).split(" ");
                        logoMap[temp[1]] = temp[0];

                    });

                    if (ratio >= 1.5) {
                        if (!(typeof logoMap["2x"] == "undefined")) rdyGlobals.logoURL = logoMap["2x"];
                        else rdyGlobals.logoURL = logoMap["1x"];
                    }
                    else {
                        if (!(typeof logoMap["1x"] == "undefined")) rdyGlobals.logoURL = logoMap["1x"];
                        else rdyGlobals.logoURL = logoMap["2x"];
                    }
                }
            }
        };
        retinizer();

    });


    /* init Functions */

    function initShare() {
        var windowLocation = window.location.href.replace(window.location.hash, '');

        String.prototype.to_rfc3986 = function() {
            var tmp;
            tmp = encodeURIComponent(this);
            return tmp.replace(/[!'()*]/g, function(c) {
                return "%" + c.charCodeAt(0).toString(16);
            });
        };

        var is_encoded = function(str) {
            str = str.to_rfc3986();
            return decodeURIComponent(str) !== str;
        };

        var encode = function(str) {
            if (typeof str === "undefined" || is_encoded(str)) {
                return str;
            } else {
                return str.to_rfc3986();
            }
        };

        var openSharePopup = function(url, params) {
            var k, popup, qs, v;
            if (params == null) {
                params = {};
            }
            popup = {
                width: 500,
                height: 350
            };
            popup.top = (screen.height / 2) - (popup.height / 2);
            popup.left = (screen.width / 2) - (popup.width / 2);
            qs = ((function() {
                var _results;
                _results = [];
                for (k in params) {
                    v = params[k];
                    _results.push("" + k + "=" + (encode(v)));
                }
                return _results;
            }).call(this)).join('&');
            if (qs) {
                qs = "?" + qs;
            }
            return window.open(url + qs, 'targetWindow', "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=" + popup.left + ",top=" + popup.top + ",width=" + popup.width + ",height=" + popup.height);
        }

        function facebookShare(){
            openSharePopup('https://www.facebook.com/sharer/sharer.php', {
                u: windowLocation
            });

            return false;
        }

        function googlePlusShare(){
            openSharePopup('https://plus.google.com/share', {
                url: windowLocation
            });

            return false;
        }

        function twitterShare(){
            var $pageTitle = encodeURIComponent($(document).find("title").text());
            openSharePopup('https://twitter.com/intent/tweet', {
                text: $pageTitle,
                url: windowLocation
            });

            return false;
        }


        function linkedInShare(){
            var $pageTitle = encodeURIComponent($(document).find("title").text());
            openSharePopup('https://www.linkedin.com/shareArticle', {
                text: $pageTitle,
                url: windowLocation
            });

            return false;
        }

        function pinterestShare(){
            var $pageTitle = encodeURIComponent($(document).find("title").text());
            var $sharingImg = ( $(this).data('featured-image') ) ? $(this).data('featured-image') : '';
            openSharePopup('https://www.pinterest.com/pin/create/button', {
                url: windowLocation,
                media: $sharingImg,
                description: $pageTitle
            });

            return false;
        }

        $('body').on('click','.post-share-buttons .fa-facebook', facebookShare);
        $('body').on('click','.post-share-buttons .fa-google-plus', googlePlusShare);
        $('body').on('click','.post-share-buttons .fa-twitter', twitterShare);
        $('body').on('click','.post-share-buttons .fa-pinterest', pinterestShare);
        $('body').on('click','.post-share-buttons .fa-linkedin', linkedInShare);

    }

    function initNavigationBar() {

        if($('.navigation-bar.type1').length){

            var stickyNav = function(){

                var scrollTop = $(window).scrollTop();
                var stickyNavBottom = 2000;
                if($('#navigation-bar-side').length){
                    stickyNavBottom = $('#navigation-bar-side').offset().top - $(window).height();
                }

                var stickyNavTop = $('.content-area .hentry').offset().top - $(window).height() + 200;

                if (scrollTop > stickyNavTop && scrollTop < stickyNavBottom) {
                    $('.navigation-bar.type1').addClass('sticky');
                } else {
                    $('.navigation-bar.type1').removeClass('sticky');
                }

            };

            if($('.content-area .hentry').length){
                $(window).scroll(function() {
                    stickyNav();
                });
            }

        }

        if($('.navigation-bar.type2').length){
            var navBarVisible = false;
            
            var hideNavBar = function(){
                var scrollTop = $(window).scrollTop();
                if($('#navigation-bar-side').length){
                    var stickyNavBottom = $('#navigation-bar-side').offset().top - $(window).height();
                }
                
                var stickyNavTop = $('.content-area .hentry').offset().top - $(window).height() + 200;

                if (scrollTop > stickyNavTop && scrollTop < stickyNavBottom ) {
                    if(!navBarVisible){
                        navBarVisible = true;
                        $('.navigation-bar.type2').velocity("stop").velocity("fadeIn", {
                            duration: 500
                        });
                    }
                } else if(navBarVisible) {
                    navBarVisible = false;
                    $('.navigation-bar.type2').velocity("stop").velocity("fadeOut", {
                        duration: 500
                    });
                }

            };

            hideNavBar();
            if($('.content-area .hentry').length){
                $(window).scroll(function() {
                    hideNavBar();
                });
            }
        }
    }


    function initRdyListAnimation() {
        $('.b_list').each(function(){
            var that = $(this);
            var $icon = $(this).data('list-icon');
            var $animation = $(this).data('animation');
            var $animation_repeat = $(this).data('animation-repeat') ? true : false;

            if($(this).find('li i').length == 0) {

                if($icon) $(this).find('li').prepend('<i class="'+$icon+ '"></i> ');
                if($animation) {

                    $(this).waypoint(function(direction) {
                        if (direction == 'down') {
                            var li_list = that.find('li');
                            li_list.each(function (i) {
                                jQuery(this).delay(i * 250).animate({
                                    'opacity': '1',
                                    'left': '0'
                                }, 350, 'easeOutCubic');
                            });
                        }
                    }, { offset: '90%', triggerOnce: $animation_repeat ? false : true });

                    if($animation_repeat) {
                        $(this).waypoint(function(direction) {
                            if (direction == 'up') {
                                var li_list = that.find('li');
                                li_list.each(function(i) {
                                    jQuery(this).css({
                                        'opacity': '0',
                                        'left' : '-20px'
                                    });
                                });
                            }

                        }, { offset: '110%' });
                    }
                }

            }

        });
    }


    function initPortfolioListAnimation() {
        $.Velocity.RegisterUI("portfolio.slideLeftIn", {
            defaultDuration: 100,
            calls: [
                [ { opacity: [ 1, 0 ], translateX: [ 0, -30 ], translateZ: 0 }, { easing: "easeOutCubic" }  ]
            ]
        });
        $.Velocity.RegisterUI("portfolio.slideUpIn", {
            defaultDuration: 100,
            calls: [
                [ { opacity: [ 1, 0 ], translateY: [ 0, 30 ], translateZ: 0 }, { easing: "easeOutCubic" }  ]
            ]
        });
        $.Velocity.RegisterUI("portfolio.fadeIn", {
            defaultDuration: 150,
            calls: [
                [ { opacity: [ 1, 0 ] }, { easing: "easeOutCubic" }  ]
            ]
        });

        $('.rdy-portfolio-container.list-animation').each(function(){
            var that = $(this);
            var $animation, $animation_reset;
            var $animation_repeat = $(this).data('animation-repeat') ? true : false;

            if ($(this).data('animation') == 'slideLeftIn') {
                $animation = "portfolio.slideLeftIn";
                $animation_reset = {
                    'opacity': '0',
                    'transform' : 'translateX(-30px)'
                }
            } else if ($(this).data('animation') == 'slideUpIn') {
                $animation = "portfolio.slideUpIn";
                $animation_reset = {
                    'opacity': '0',
                    'transform' : 'translateY(30px)'
                }
            } else if ($(this).data('animation') == 'fadeIn') {
                $animation = "portfolio.fadeIn";
                $animation_reset = {
                    'opacity': '0'
                }
            }

            if($(this).find('.hentry').length > 0 && $animation) {
                $(this).waypoint(function(direction) {
                    if (direction == 'down') {
                        var li_list = that.find('.hentry');
                        li_list.velocity('stop').velocity($animation, { stagger: 300 });
                    }
                }, { offset: '90%', triggerOnce: $animation_repeat ? false : true });

                if($animation_repeat) {
                    $(this).waypoint(function(direction) {
                        if (direction == 'up') {
                            var li_list = that.find('.hentry');
                            li_list.each(function(i) {
                                jQuery(this).css($animation_reset);
                            });
                        }

                    }, { offset: '110%' });
                }

            }

        });
    }


    function initFullScreenHeader(){

        var pageHeaderHeight = parseInt($('#page-header-bg').attr('data-height'), 10);

        if($('#fancy-header').length > 0) {

            var isHeaderFullHeight = $('body #fancy-header.fullscreen-header').length > 0 ? true : false;
            var extraHeight = ($("#wpadminbar").length > 0) ? $("#wpadminbar").height() : 0;
            var fancyHeaderHeight = $('#fancy-header').height();

            pageHeaderHeight = $(window).height() - extraHeight;

            if($(window).width() < 992){
                pageHeaderHeight = pageHeaderHeight -  $('#header').height();
            }else{
                if($('#header-menu.static-layout.with-background').length){
                    pageHeaderHeight = pageHeaderHeight - $('#header-menu').height();
                }

                if($('#header-menu.fixed-layout').length && !$('#header').data('background-appear') && $('#header-menu.with-background').length){
                    pageHeaderHeight = pageHeaderHeight - $('#header-menu').height();
                }
            }

            if(isHeaderFullHeight) {
                fancyHeaderHeight = pageHeaderHeight;
                $('#fancy-header').css({
                    'height': pageHeaderHeight + 'px',
                    'min-height': pageHeaderHeight + 'px'
                }).removeClass('not-loaded');
                $('#fancy-header .col-table').css({'height': (pageHeaderHeight) + 'px'});
            }

            if(!rdyGlobals.isMobile){
                var scrl_anim = $('#fancy-header .scroll-animation');
                if(scrl_anim.data('opacity') && scrl_anim.data('down')){
                    if($('#fancy-header').hasClass('fh-va-bottom')){
                        var offset;

                        if(isHeaderFullHeight){
                            offset = parseInt(fancyHeaderHeight, 10) * 0.25;
                        }else{
                            offset = parseInt(fancyHeaderHeight, 10) * 0.4;
                        }
                    }else{
                        offset = parseInt(fancyHeaderHeight, 10) * 0.5;
                    }

                    setSkrollr(scrl_anim, [[0, 'opacity:1;transform: translateY(0px)'], [parseInt(fancyHeaderHeight, 10), 'opacity:0;transform: translateY('+ (offset) +'px)']]);

                }else if(scrl_anim.data('opacity')){
                    if($('#fancy-header').hasClass('fh-va-bottom')){
                        setSkrollr(scrl_anim, [[0, 'opacity:1;'], [fancyHeaderHeight * 0.7, 'opacity:0;']]);
                    }else{
                        setSkrollr(scrl_anim, [[0, 'opacity:1;'], [fancyHeaderHeight * 0.5, 'opacity:0;']]);
                    }

                }else if(scrl_anim.data('down')){
                    setSkrollr(scrl_anim, [[0, 'transform: translateY(0px)'], [parseInt(pageHeaderHeight, 10), 'transform: translateY('+ (parseInt(pageHeaderHeight, 10)/2) +'px)']]);
                }

                if(window.skrollr) {
                    var s = skrollr.init({
                        smoothScrolling: false,
                        forceHeight: false,
                        mobileCheck: function () {
                            return false;
                        }
                    });
                    s.refresh();
                }

            }

            $("#fancy-header.fullscreen-header").css("opacity", "1");

            $("#fancy-header .background-container:not(.fancy_parallax)").each(function() {//:not(.fancy_parallax)
                var background_load_opt = {};

                if($(this).data('bg_animation')){
                    background_load_opt = {
                        effect : "fadeIn",
                        effectspeed: $('#fancy-header .background-container[data-bg_animation="1"]').length ? 1000 : 0
                    };
                }


                if ($(window).width() < 992) {
                    if($(this).data('original-mobile')){
                        background_load_opt.data_attribute = 'original-mobile';
                        $(this).lazyload(background_load_opt);
                    } else if($(this).data('original')){
                        $(this).lazyload(background_load_opt);
                    }
                } else {
                    if($(this).data('original')){
                        $(this).lazyload(background_load_opt);
                    }
                }


            });

        }

        setTimeout(function(){ $('#fancy-header').css('overflow','hidden') },800);

    }


    /***************** WP Media Embed / External Embed ******************/

    function initResponsiveVideoIframesInit(){
        $(".post-wrapper .video, body.single-post article.video .video-wrap, .rdy_latest_post .boxes_wrapper .video").fitVids();
    }


    function initClientList() {
        "use strict";

        $('.rdy-clients-shortcode.column-style').each(function() {
            var group = $(this),
                list = group.find('li'),
                listStyle = group.find('ul').attr('style'),
                fullRowColumns = group.find('ul:first-of-type li').length,
                viewport = $(window),
                viewportWidth = viewport.innerWidth(),
                breakPoint1 = 960 - 25,
                breakPoint2 = 767 - 25,
                breakPoint3 = 550 - 25;

            if(listStyle == undefined) listStyle = '';

            function recreateGrid() {
                if (viewportWidth > breakPoint1) {
                    list.unwrap();
                    for (var i = 0; i < list.length; i += fullRowColumns) {
                        list.slice(i, i + fullRowColumns)
                            .wrapAll('<ul style="' + listStyle + '"></ul>');
                    }
                } else if (viewportWidth < breakPoint2) {
                    list.unwrap();
                    for (var i = 0; i < list.length; i += 2) {
                        list.slice(i, i + 2).wrapAll('<ul class="rdy-clients-fixed-list" style="' + listStyle + '"></ul>');
                    }
                } else if (viewportWidth < breakPoint1) {
                    list.unwrap();
                    for (var i = 0; i < list.length; i += 3) {
                        list.slice(i, i + 3).wrapAll('<ul class="rdy-clients-fixed-list" style="' + listStyle + '"></ul>');
                    }
                }
            }
            recreateGrid();

            $(window).on('debouncedresize', function() {
                viewportWidth = viewport.innerWidth();
                recreateGrid();
            });

        });
    }


    function initParallax(){
        "use strict";

        if(!window.skrollr) return;

        var parallaxHeader = function () {
            var vcSkrollrOptions,
                callSkrollInit = false;

            $( '#fancy-header .fancy_parallax-inner' ).remove();
            $( '#fancy-header .fancy_parallax' ).each( function () {
                var skrollrSize,
                    $parallaxElement,
                    parallaxImage;

                callSkrollInit = true; // Enable skrollinit;

                skrollrSize = 110;
                if ($(window).width() < 992) {
                    if($(this).data('original-mobile')){
                        skrollrSize = 110;
                        parallaxImage = $( this ).data( 'original-mobile' );
                    }
                }

                if (!parallaxImage) {
                    parallaxImage = $( this ).data( 'vcParallaxImage' );
                }


                var $this = $( this );
                var parallaxImg = new Image;
                parallaxImg.src = parallaxImage;
                parallaxImg.onload = function () {
                    $parallaxElement = $( '<div />').css({opacity: 0}).addClass( 'fancy_parallax-inner' ).appendTo( $this );
                    $parallaxElement.height( skrollrSize + '%' );
                    $parallaxElement.velocity("transition.fadeIn");

                    if ( parallaxImage !== undefined ) {
                        $parallaxElement.css( 'background-image', 'url(' + parallaxImage + ')' );
                    }

                    $parallaxElement.attr( 'data-start', 'top: ' + (-10) + '%' ).attr( 'data-top-bottom', 'top:  ' + 20 + '%' );

                    rdy.fxGlitchOverlayHeader();
                }

            } );

            if ( callSkrollInit && window.skrollr ) {
                /*vcSkrollrOptions = {
                    forceHeight: false,
                    smoothScrolling: false,
                    mobileCheck: function () {
                        return false;
                    }
                };
                var vcParallaxSkroll = skrollr.init( vcSkrollrOptions );
                vcParallaxSkroll.refresh();*/
                window.onload = function() {
                    if(window.skrollr && typeof skrollr.get() != "undefined") { skrollr.get().refresh(); }
                };

            }

            return false;
        };

        parallaxHeader();

    }


    function initCounterRandom(){
        "use strict";

        if($('.b_counter_holder.random').length){
            $('.b_counter_holder.random').each(function() {
                var $counter = $(this).find('.counter .digit');

                if(!$counter.hasClass('executed')){
                    $counter.addClass('executed');

                    var animation = $counter.data('animation'),
                        speed = $counter.data('speed') ? $counter.data('speed') : 2000,
                        delay = $counter.data('delay') ? $counter.data('delay') : 0;
                    var obj_this = this;

                    $counter.waypoint(function(direction) {
                        $(obj_this).css('opacity', '1');
                        $counter.absoluteCounter({
                            speed: speed,
                            fadeInDelay: 1000,
                            onComplete: function() {
                                if(animation) {
                                    $counter.velocity({
                                        scaleX: 1.1,
                                        scaleY: 1.1,
                                        opacity: .8
                                    }, 50, {easing: "easeOutElastic"})
                                        .velocity({scaleX: 1, scaleY: 1, opacity: 1}, 100, {easing: "easeOutElastic"})
                                }
                            }
                        });

                    }, { offset: '90%', triggerOnce: true });
                }
            });
        }
    }


    function initToCounter(){
        "use strict";

        if($('.b_counter_holder.zero').length){
            $('.b_counter_holder.zero').each(function() {
                var $counter = $(this).find('.counter .digit');

                if(!$counter.hasClass('executed')){
                    $counter.addClass('executed');
                    var obj_this = this;
                    var repeatOnce = $counter.data('repeat') ? false : true;

                    var useOnComplete = false,
                        useEasing = true,
                        useGrouping = true,
                        animation = $counter.data('animation'),
                        duration = $counter.data('speed') ? $counter.data('speed')/1000 : 2.5,
                        options = {
                            useEasing : true,
                            useGrouping : true,
                            separator : $counter.data('separator') ? $counter.data('separator') : ''
                            //decimal : '.'
                        };

                    $counter.waypoint(function(direction){
                        if(direction == 'down') {
                            setTimeout(function () {
                                $(obj_this).css('opacity', '1');

                                var numAnim = new CountUp($counter[0], 0, $counter.data('count'), 0, duration, options);
                                numAnim.start(function () {
                                    if (animation) {
                                        $(obj_this).velocity("stop").velocity({
                                                scaleX: 1.1,
                                                scaleY: 1.1
                                            }, {duration: 100, easing: "easeInOut"})
                                            .velocity({scaleX: 1, scaleY: 1}, {duration: 600, easing: [200, 8]});

                                        setTimeout(function () {
                                            $(obj_this).css({opacity: .3}).velocity({
                                                opacity: 1
                                            }, {duration: 1000, queue: false, easing: "easeOutExpo"})
                                        }, 0);

                                    }
                                });
                            }, $(obj_this).data('delay') ? $counter.data('delay') : 0);
                        }
                    }, { offset: '90%', triggerOnce: repeatOnce });

                }
            });
        }
    }


    function initCounterMotion() {
        $('.b_counter_holder.motion').each(function() {
            var $counter = $(this).find('.counter');

            if($counter.is('[data-symbol]')) {
                if ($counter.attr('data-symbol-pos') == 'before') {
                    $counter.find('.digit').prepend('<div class="symbol-wrap"><span class="symbol">'
                        + $counter.attr('data-symbol') + '</span></div>');
                } else {
                    $counter.find('.digit').append('<div class="symbol-wrap"><span class="symbol">'
                        + $counter.attr('data-symbol') + '</span></div>');
                }

                var $symbol_size = ( $counter.attr('data-symbol-size') == $counter.find('.digit').attr('data-number-size') );
                $counter.find('.symbol-wrap').css({'font-size': $symbol_size + 'px', 'line-height': $symbol_size + 'px'});
            }

            $counter.find('.digit').css({
                'font-size': $counter.find('.digit').attr('data-number-size') +'px',
                'line-height': $counter.find('.digit').attr('data-number-size') + 'px'
            });
        });


        if(!$('body').hasClass('mobile')) {

            var $blurCssString = '';
            $('.b_counter_holder.motion').each(function(i){
                var $counter = $(this).find('.counter');

                $counter.addClass('instance-'+i);

                var $currentColor = $counter.find('.digit').css('color');
                var rgb = $currentColor.match(/^rgb\((\d+)\,\s*(\d+)\,\s*(\d+)\)$/);
                var R = rgb[1];
                var G = rgb[2];
                var B = rgb[3];

                var $rgbaColor0 = 'rgba('+R+','+G+','+B+',0.2)';
                var $rgbaColor1 = 'rgba('+R+','+G+','+B+',1)';
                var $numberSize = parseInt($counter.find('.digit').css('font-size'), 10);

                $blurCssString += '@keyframes motion-blur-number-'+i+' { ' +
                    ' 0% { '+
                    'color: '+$rgbaColor0+'; '+
                    'text-shadow: 0 '+$numberSize/20+'px 0 '+$rgbaColor0+', 0 '+$numberSize/10+'px 0 '+$rgbaColor0+', 0 '+$numberSize/6+'px 0 '+$rgbaColor0+', 0 '+$numberSize/5+'px 0 '+$rgbaColor0+', 0 '+$numberSize/4+'px 0 '+$rgbaColor0+', 0 -'+$numberSize/20+'px 0 '+$rgbaColor0+', 0 -'+$numberSize/10+'px 0 '+$rgbaColor0+', 0 -'+$numberSize/6+'px 0 '+$rgbaColor0+', 0 -'+$numberSize/5+'px 0 '+$rgbaColor0+', 0 -'+$numberSize/4+'px 0 '+$rgbaColor0+'; '+
                    'opacity: 0; transform: translateZ(0px) translateY(-100%); -webkit-transform: translateZ(0px) translateY(-100%); '+
                    '} '+
                    '35% { opacity: 1 }' +
                    '100% { '+
                    'color: '+$rgbaColor1+'; '+
                    'text-shadow: none; '+
                    'transform: translateZ(0px) translateY(0px); -webkit-transform: translateZ(0px) translateY(0px); '+
                    '} '+
                    '} '+
                    '@-webkit-keyframes motion-blur-number-'+i+' { ' +
                    ' 0% { '+
                    'color: '+$rgbaColor0+'; '+
                    'text-shadow: 0 '+$numberSize/20+'px 0 '+$rgbaColor0+', 0 '+$numberSize/10+'px 0 '+$rgbaColor0+', 0 '+$numberSize/6+'px 0 '+$rgbaColor0+', 0 '+$numberSize/5+'px 0 '+$rgbaColor0+', 0 '+$numberSize/4+'px 0 '+$rgbaColor0+', 0 -'+$numberSize/20+'px 0 '+$rgbaColor0+', 0 -'+$numberSize/10+'px 0 '+$rgbaColor0+', 0 -'+$numberSize/6+'px 0 '+$rgbaColor0+', 0 -'+$numberSize/5+'px 0 '+$rgbaColor0+', 0 -'+$numberSize/4+'px 0 '+$rgbaColor0+'; '+
                    'opacity: 0; transform: translateZ(0px) translateY(-100%); -webkit-transform: translateZ(0px) translateY(-100%); '+
                    '} '+
                    '35% { opacity: 1 }' +
                    '100% { '+
                    'color: '+$rgbaColor1+'; '+
                    'text-shadow: none; '+
                    'transform: translateZ(0px) translateY(0px); -webkit-transform: translateZ(0px) translateY(0px); '+
                    '} '+
                    '} '+
                    '.b_counter_holder .counter.motion.instance-'+i+' .digit span.in-sight { animation: 0.65s cubic-bezier(0, 0, 0.17, 1) 0s normal backwards 1 motion-blur-number-'+i+'; -webkit-animation: 0.65s cubic-bezier(0, 0, 0.17, 1) 0s normal backwards 1 motion-blur-number-'+i+'; } ';

                var $symbol = $counter.find('.symbol-wrap').clone();
                $counter.find('.symbol-wrap').remove();
                var characters = $counter.find('.digit').text().split("");
                var $this = $counter.find('.digit');
                $this.empty();

                $.each(characters, function (i, el) {
                    if(el == ' ') el = '&nbsp;';
                    $this.append("<span>" + el + "</span>");
                });

                if($counter.has('[data-symbol]')) {
                    if($counter.attr('data-symbol-pos') == 'after') {
                        $this.append($symbol);
                    } else {
                        $this.prepend($symbol);
                    }
                }

            });

            var head = document.head || document.getElementsByTagName('head')[0];
            var style = document.createElement('style');

            style.type = 'text/css';
            if (style.styleSheet){
                style.styleSheet.cssText = $blurCssString;
            } else {
                style.appendChild(document.createTextNode($blurCssString));
            }

            head.appendChild(style);

            $('.b_counter_holder.motion').each(function() {
                var $counter = $(this).find('.counter');

                $(this).css('opacity', 1);
                var $offset = ($counter.hasClass('motion')) ? '90%' : '105%';
                var repeatOnce = $counter.find('.digit').data('repeat') ? false : true;

                $counter.waypoint(function(direction) {
                    if($counter.hasClass('motion') && direction == 'down') {
                        if (!$counter.hasClass("animation-triggered")) {
                            $counter.addClass("animation-triggered");
                            $counter.find('span').each(function (i) {
                                var $that = $(this);
                                setTimeout(function () {
                                    $that.addClass('in-sight');
                                }, 200 * i);

                            });
                        }
                    }

                }, { offset: $offset, triggerOnce: repeatOnce });

                $counter.waypoint(function(direction) {
                    if ($counter.hasClass('motion') && direction == 'up') {
                        $counter.removeClass("animation-triggered");
                        $counter.find('span').removeClass("in-sight");
                    }

                }, { offset: '110%', triggerOnce: repeatOnce });
            });

        }

    }


    function initToCounterPieChart($this){
        "use strict";

        $($this).css('opacity', '1');

        var $max = parseFloat($($this).data('percent'));
        var $animate = 1500;

        if($($this).data('animation-speed') !== "" && $($this).data('animation-speed') != "0"){
            $animate = $($this).data('animation-speed');
        }

        $($this).find('.tocounter').countTo({
            from: 0,
            to: $max,
            speed: $animate,
            refreshInterval: 50
        });
    }


    function initPieChart(){
        "use strict";

        if($('.b_percentage').length){
            $('.b_percentage').each(function() {

                var $barColor =  "#ff0000";

                if($(this).data('active') !== ""){
                    $barColor = $(this).data('active');
                }

                var $trackColor = '#eeeeee';

                if($(this).data('noactive') !== ""){
                    $trackColor = $(this).data('noactive');
                }

                var $line_width = 10;
                var $animate = 1500;

                if($(this).data('linewidth') !== ""){
                    $line_width = $(this).data('linewidth');
                }
                if($(this).data('animation-speed') !== "" && $(this).data('animation-speed') != "0"){
                    $animate = $(this).data('animation-speed');
                }

                var $size = 174;

                if($(this).data('width') !== ""){
                    $size = parseInt($(this).data('width'), 10);
                    if(!($size>30)){
                        $size = 174;
                    }
                }

                var $lineCap = 'butt';

                if($(this).data('round') == "1"){
                    $lineCap = 'round';
                }

                $(this).width($size);
                $(this).height($size);
                $(this).css('line-height', $size+'px');

                var obj_this = this;

                $(this).waypoint(function(direction) {
                    initToCounterPieChart($(obj_this));
                    $(obj_this).parent().css('opacity', '1');

                    $(obj_this).easyPieChart({
                        barColor: $barColor,
                        trackColor: $trackColor,
                        scaleColor: false,
                        lineCap: $lineCap,
                        lineWidth: $line_width,
                        animate: $animate,
                        size: $size
                    });

                }, { offset: '90%', triggerOnce: true });
            });
        }
    }


    function initMessages(){
        "use strict";

        if($('.b_message').length){
            $('.b_message').each(function(){
                $(this).find('.close').click(function(e){
                    e.preventDefault();
                    $(this).parent().parent().fadeOut(500);
                });
            });
        }
    }


    function initOwlSlider(){
        "use strict";

        $('.rdy-owlslider.rdy-clients-shortcode').each(function () {
            $(this).find('.rdy-owl-slides').owlCarousel({
                autoplay: $(this).data('autoplay'),
                smartSpeed: $(this).data('animationSpeed'),
                autoplayTimeout: $(this).data('autoplayTimeout') ? $(this).data('autoplayTimeout') : 4000,
                autoplayHoverPause: $(this).data('pauseonhover'),
                items: $(this).data('maxitems'),
                loop: true,
                responsiveClass: true,
                dots: false,
                nav: false,
                responsive : {
                    0 : {
                        items: 2
                    },
                    768 : {
                        items: $(this).data('maxitems')
                    }
                }
            });
        });

        rdy.carousel($('body'));

        $(".owl-testimonials").each(function() {

            var autoplay = false;
            var autoplaytime = 0;
            var loop = true;
            var nav = true;
            var fade_in = '';
            var fade_out = '';

            if ($(this).data('autoslide')) {
                autoplay = true;
                autoplaytime = $(this).data('autoslide');
            }

            if ($(this).data('animation') == 'fadein') {
                fade_in = 'fadeIn';
                fade_out = '';
            } else if ($(this).data('animation') == 'downflip') {
                fade_in = 'flipInX';
                fade_out = 'fadeOutDown';
            }


            if($( this).find('.item').length == 1){
                loop = false;
                nav = false;
            }

            $( this ).owlCarousel({

                autoplay: autoplay,
                autoplayTimeout: autoplaytime,
                autoplayHoverPause: true,
                themeClass : "owl-testimonials",
                autoHeight: true,
                dots: nav,
                nav: nav,
                navText: ["",""],
                items: 1,
                loop: loop,
                animateIn: fade_in,
                animateOut: fade_out

            });

        });

        $(".owl-slider").each(function() {

            $(this).owlCarousel({

                autoplay: !0,
                navSpeed: 700,
                smartSpeed: 700,
                autoheight: false,
                themeClass : "owl-theme-slider",
                dots: !1,
                nav: !0,
                navText: ["",""],
                items: 1,
                loop: true

            });

        });

        /*$(".owl-posts-slider").each(function() {

            $(this).owlCarousel({

                autoplay: false,
                navSpeed: 700,
                smartSpeed: 700,
                autoheight: false,
                // themeClass : "owl-theme-slider0",
                dots: false,
                nav: false,
                navText: ["",""],
                items: 4,
                loop: true

            });

        });*/

        $(".products.owl-carousel").each(function() {
            var autoplay = false;
            var autoplaytime = 0;
            var nav = false;
            var dots = false;
            var columns = $(this).data('columns') ? $(this).data('columns') : 3;

            if ($(this).data('autoslide')) {
                autoplay = true;
                autoplaytime = $(this).data('autoslide');
            }
            if ($(this).data('slider-dots')) {
                dots = true;
            }
            if ($(this).data('slider-nav')) {
                nav = true;
            }

            $(this).owlCarousel({

                autoplay: autoplay,
                autoplayTimeout: autoplaytime,
                autoplayHoverPause: true,
                autoheight: false,
                themeClass : "owl-theme-slider",
                dots: dots,
                nav: nav,
                navText: ['', ''],
                items: columns,
                loop: false,
                responsive: {
                    0: {
                        items: 1
                    },
                    600: {
                        items: 2
                    },
                    960: {
                        items: columns
                    }
                }

            });

        });
    }


    function magnificPopup() {
        "use strict";

        if ($(".mfp-lightbox").magnificPopup) {
            $(".mfp-lightbox").magnificPopup({
                type: "image",
                mainClass: 'mfp-zoom-in',
                gallery: {enabled: !0},
                tLoading: '',
                closeBtnInside: false,
                closeMarkup: '<button title="%title%" type="button" class="mfp-close"></button>',
                removalDelay: 400
            })
        }

        if ($(".rdy_gallery").magnificPopup) {
            $(".rdy_gallery").each(function () {
                $(this).magnificPopup({
                    delegate: 'figure a.link.lightbox',
                    type: "image",
                    mainClass: 'mfp-zoom-in',
                    gallery: {enabled:!0},
                    tLoading: '',
                    closeBtnInside: false,
                    closeMarkup: '<button title="%title%" type="button" class="mfp-close"></button>',
                    removalDelay: 400
                })
            });
        }

        if ($(".rdy-video-lightbox").magnificPopup) {
            $(".rdy-video-lightbox").magnificPopup({
                type: "iframe",
                mainClass: 'mfp-zoom-in',
                fixedContentPos: false,
                closeBtnInside: false,
                closeMarkup: '<button title="%title%" type="button" class="mfp-close"></button>',
                removalDelay: 400
            });

            $('.rdy-video-lightbox').on('click', function(e){
                return false;
            });
        }
    }


    function resizeImage(container) {
        var canvas = container.find('.fx-motion'),
            img = container.find('.fx-motion img'),
            imgRatio = container.data('imgRatio'),
            containerRatio = container.innerWidth() / container.innerHeight();

        imgRatio > containerRatio ? (
            $(img).css("height", "100%").css("width", "auto"),
            canvas.css("height", "100%").css("width", "auto")
        ) : containerRatio > imgRatio && (
            $(img).css("width", "100%").css("height", "auto"),
            canvas.css("width", "100%").css("height", "auto")
        )
    }


    function debounce(func, wait, immediate) {
        var timeout;

        return function () {
            var context = this, args = arguments, later = function () {
                timeout = null,
                immediate || func.apply(context, args)
            }, callNow = immediate && !timeout;
            clearTimeout(timeout),
            timeout = setTimeout(later, wait),
            callNow && func.apply(context, args)
        }
    }


    function initWoocommerce() {

        if($('body.woocommerce').hasClass('single-product')){
            if ($.isFunction(window.vc_tabsBehaviour)){
                vc_tabsBehaviour();
            }
        }

        if(!rdyGlobals.isMobile) {

            var $easyzoom = $('.product-zoom .easyzoom').easyZoom({ loadingNotice: '' });

            if($('.product-zoom .easyzoom').length > 0) {
                var easyzoom_api = $easyzoom.data('easyZoom');

                $("table.variations").on('change', 'select', function() {
                    easyzoom_api.teardown();
                    easyzoom_api._init();
                });
            }

        }

        if (jQuery.fn.isotope != undefined) {
            var $container = $('.woocommerce .products.products-grid:not(.owl-carousel)');
            $container.each(function () {
                var is_shortcode = $(this).parent('.woocommerce-shortcode').length ? 1 : 0;
                var this_container = $(this);

                this_container.imagesLoaded( function () {
                    if(this_container.hasClass('woo-masonry') && !is_shortcode){
                        this_container.isotope({
                            itemSelector: '.product-item, .shop-item',
                            masonry: {
                            }
                        });

                    }else{
                        this_container.isotope({
                            itemSelector: '.product-item, .shop-item',
                            layoutMode: 'fitRows'
                        });

                    }

                    if(this_container.hasClass('wc_catalog_animation')){
                        this_container.one( 'layoutComplete',
                            function( event, laidOutItems ) {
                                if(window.skrollr) skrollr.get().refresh();
                            }
                        );
                    }
                    this_container.isotope('layout');

                    setTimeout(function(){
                        $(window).trigger('resize');
                    }, 150);
                });

            });

            $(window).on('debouncedresize', function() {
                if(window.skrollr) skrollr.get().refresh();
            });
        }

    }


    function initWoocommerceSpinner() {
        "use strict";

        if($('body').hasClass('woocommerce-page')){
            if(typeof jQuery('.qty').spinner === 'function') {
                jQuery('.qty').spinner({
                    min: 1
                });

                jQuery('.ui-spinner-button.ui-spinner-up').html('+');
                jQuery('.ui-spinner-button.ui-spinner-down').html('-');
                jQuery(".ui-spinner-button.ui-spinner-up, .ui-spinner-button.ui-spinner-down").on("click",function(){
                    jQuery(this).closest(".quantity").find(".input-text").trigger("change");
                });

            }
        }

    }


/*

    function initMasonryPortfolio_Filter() {
        $('.filter_holder .filter').click(function () {
            var $this = $(this);
            var $container = $this.parents('.filter_portfolio').next( '.rdy-portfolio-container' );

            if ($this.hasClass('.current')) {
                return false;
            }

            var $optionSet = $this.parents('.filter_holder');
            $optionSet.find('.current').removeClass('current');
            $this.addClass('current');

            var selector = $(this).attr('data-filter');

            $container.isotope({
                filter: ''
            });

            $container.isotope({
                filter: selector
            });

            setTimeout(function () {
                $container.isotope('layout');
            }, 400);

            return false;
        });
    }

    */
/*
    function initInfiniteScroll() {
        var $container = $('.infinite-scroll .iso-container');
        var is_masonry = $('.infinite-scroll .rdy-masonry, .infinite-scroll .rdy-grid').length ? true : false;

        $container.infinitescroll({
                navSelector: '.paginator .page-nav',
                nextSelector: '.paginator .page-nav a:first',
                itemSelector: '.grid-item',
                animate: false,
                maxPage: $('.paginator').data('max-pages'),
                loading: {
                    finishedMsg: "",
                    msg: $('<div class="loader"><div class="circle"></div></div>'),
                    msgText: "",
                    selector: ".infinite-loading",
                    speed: 0
                },
                errorCallback: function () {
                    $(".infinite-loading, .rdy-load-more").hide(0);
                }
            },
            function (newElements) {
                var $newElems = jQuery(newElements);
                $container.append($container.find('.grid-sizer'));

                if (is_masonry) {
                    $newElems.imagesLoaded(function () {
                        $container.isotope('appended', $newElems);

                    });

                    $(window).trigger('resize');
                }

                var $items_animation = $container.data('items-animation');
                if ($items_animation) {
                    $.each($newElems, function (index, val) {
                        if ($(val).hasClass('do-animation')) {
                            $(val).css('opacity', '0');
                            $(val).waypoint(function (direction) {
                                var $animation = "transition.fadeIn";

                                if($items_animation == 'fadeIn'){
                                    $animation = "transition.fadeIn";
                                }else if($items_animation == 'slideUpBigIn'){
                                    $animation = "transition.slideUpBigIn";
                                }else if($items_animation == 'expandIn'){
                                    $animation = "transition.expandIn";
                                }

                                $(this).velocity($animation, {
                                    duration: 600,
                                    delay: 500,
                                    drag: true,
                                    display: 'auto',
                                    easing: [ .17,.67,.83,.67 ]

                                });

                            }, {offset: '85%', triggerOnce: true});
                        }
                    });
                }

                //responsiveVideoIframesInit();
            }
        );

        if ($container.hasClass('load-button-style')) {
            $(window).unbind('.infscr');
            $('.rdy-load-more').click(function (e) {
                e.preventDefault();
                $container.infinitescroll('retrieve');
                return false;
            });
        }

    }
*/

    function initJsHeight(){
        (function($){
            $(".js-height-full").height($(window).height());
        })(jQuery);
    }


    function rdy_guid() {
        function s4() {
            return Math.floor((1 + Math.random()) * 0x10000)
                .toString(16)
                .substring(1);
        }
        return 'u' + s4() + s4() + '-' + s4() + '-' + s4() + '-' +
            s4() + '-' + s4() + s4() + s4();
    }


    function initSVGiconAnimation(){

        var $icon = [];

        $('.vc_icon_element').each(function (i) {
            var $that = $(this);
            var $file = $that.find('.vc_icon_element-icon').data('svg');

            if(typeof $file != 'undefined') {

                if(navigator.userAgent.match(/(Android|iPod|iPhone|iPad|IEMobile|BlackBerry|Opera Mini)/)) $that.attr('svg-animation','false');

                //animation
                $(this).attr('id', 'icon-svg-instance-' + i);
                var $animationSpeed = ($that.is('[data-svg-animation-speed]') && $that.attr('data-svg-animation-speed').length > 0) ? $that.attr('data-svg-animation-speed') : 500;
                var $animationType = $that.is('[data-svg-animation-type]') ? $that.attr('data-svg-animation-type') : 'delayed';

                var $animationTiming = Vivus.LINEAR;
                if ($that.data('svg-animation-timing') == 'EASE') {
                    $animationTiming = Vivus.EASE;
                } else if ($that.data('svg-animation-timing') == 'EASE_OUT') {
                    $animationTiming = Vivus.EASE_OUT;
                } else if ($that.data('svg-animation-timing') == 'EASE_OUT') {
                    $animationTiming = Vivus.EASE_OUT;
                } else if ($that.data('svg-animation-timing') == 'EASE_IN') {
                    $animationTiming = Vivus.EASE_IN;
                } else if ($that.data('svg-animation-timing') == 'EASE_OUT_BOUNCE') {
                    $animationTiming = Vivus.EASE_OUT_BOUNCE;
                }


                if (!$that.data('svg-animation')) {
                    $animationSpeed = 1;
                    $that.css('opacity', '1');
                }

                $icon[i] = new Vivus($that.find( '.vc_icon_element-inner' ).get(0), {
                    type: $animationType,
                    pathTimingFunction: Vivus.EASE_OUT,
                    animTimingFunction: $animationTiming,
                    duration: $animationSpeed,
                    file: $file,
                    onReady: svgInit
                });

                $that.find('span').remove();

                if($animationSpeed !== 1) {

                    var $that = $(this);

                    $(this).waypoint(function(direction) {

                        checkIfReady();
                        $that.addClass('animated-in');

                    }, { offset: '90%', triggerOnce: true });

                } else {
                    checkIfReady();
                }

                function checkIfReady() {
                    var $animationDelay = ($that.data('svg-animation-delay') && $that.data('svg-animation-delay').length > 0 && $that.data('animation') != 'false') ? $that.data('svg-animation-delay') : 0;
                    if ($icon[$that.attr('id').slice(-1)].isReady == true) {
                        $that.css('opacity', '1');
                        setTimeout(function () {
                            $icon[$that.attr('id').slice(-1)].reset().play();
                        }, $animationDelay);
                    } else {
                        setTimeout(checkIfReady, 50);
                    }
                }

                function svgInit(eVivus) {
                    // eVivus.el.setAttribute('class', 'init');
                    $icon[$that.attr('id').slice(-1)].reset().stop();
                }

            }

        });

    }


    var rdy = {};

    function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

    rdy.PIXI = {};
    rdy.PIXI.Point = function () {
        function Point() {
            var x = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
            var y = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;

            _classCallCheck(this, Point);

            /**
             * @member {number}
             * @default 0
             */
            this.x = x;

            /**
             * @member {number}
             * @default 0
             */
            this.y = y;
        }

        Point.prototype.copy = function copy(p) {
            this.set(p.x, p.y);
        };

        Point.prototype.equals = function equals(p) {
            return p.x === this.x && p.y === this.y;
        };

        Point.prototype.set = function set(x, y) {
            this.x = x || 0;
            this.y = y || (y !== 0 ? this.x : 0);
        };

        return Point;
    }();
    rdy.PIXI.Point.prototype = {
        subtract: function (x, y) {
            this.x -= x;
            this.y -= y;
            return this;
        }
    };
    rdy.PIXI.Point.prototype.constructor = rdy.PIXI.Point;
    rdy.PIXI.Point.subtract = function (a, b, out) {
        if (typeof out === "undefined") { out = new rdy.PIXI.Point(); }

        out.x = a.x - b.x;
        out.y = a.y - b.y;

        return out;
    };

    rdy.cascadeAnimation = function() {
        "use strict";

        $.Velocity.RegisterUI("levelup.slideUpIn", {
            defaultDuration: 900,
            calls: [
                [ { opacity: [ 1, 0 ], translateY: [ 0, 50 ], translateZ: 0 } ]
            ]
        });

        $('.vc_row[data-csd-animation], .wpb_column[data-csd-animation]').each(function(){
            var $obj = $(this);
            var animation = $obj.data('csd-animation') ? $obj.data('csd-animation') : "transition.fadeIn";
            var stagger = $obj.data('csd-animation-delay') ? $obj.data('csd-animation-delay') : 600;
            var duration = $obj.data('csd-animation-duration') ? $obj.data('csd-animation-duration') : 600;

            $(this).waypoint(function(direction) {
                if (direction == 'down' && !$obj.data('vanimated')) {
                    $obj.data('vanimated', 1);

                    if ($obj.hasClass('vc_row')) {
                        $('> .row-container > .row-inner > .wpb_column', $obj).velocity(animation, {
                            display: "flex",
                            delay: 400,
                            stagger: stagger,
                            duration: duration,
                            easing: "ease-in",
                            begin: function(elements) { $(this).css({opacity: 1}) }
                        });
                    } else if ($obj.hasClass('wpb_column')) {
                        $('> .vc_column-inner > .wpb_wrapper > *', $obj).velocity(animation, {
                            delay: 400,
                            stagger: stagger,
                            duration: duration,
                            easing: "ease-in",
                            begin: function(elements) { $(this).css({opacity: 1}) }
                        });
                    }
                }

            }, { offset: '80%' });

        });

    }

    rdy.fxGrainOverlay = function() {
        "use strict";

        $('.vc_row > .row-overlay.filmgrain, .wpb_single_image .img-overlay.filmgrain').each(function(){
            var uid = rdy_guid();
            var $this = $(this);
            $(this).prepend('<canvas id="' + uid + '"></canvas>');

            var canvas = document.getElementById(uid);

            var viewWidth,
                viewHeight,
                ctx;

            var patternSize = 100,
                patternScaleX = 1,
                patternScaleY = 1,
                patternRefreshInterval = 5,
                patternAlpha = 60;

            var patternPixelDataLength = patternSize * patternSize * 4,
                patternCanvas,
                patternCtx,
                patternData,
                frame = 0;

            function initCanvas() {
                viewWidth = canvas.width = canvas.clientWidth;
                viewHeight = canvas.height = canvas.clientHeight;
                ctx = canvas.getContext('2d');
                ctx.scale(patternScaleX, patternScaleY);
            }


            function initGrain() {
                patternCanvas = document.createElement('canvas');
                patternCanvas.width = patternSize;
                patternCanvas.height = patternSize;
                patternCtx = patternCanvas.getContext('2d');
                patternData = patternCtx.createImageData(patternSize, patternSize);
            }

            function update() {
                var value;

                for (var i = 0; i < patternPixelDataLength; i += 4) {
                    value = (Math.random() * 255) | 0;

                    patternData.data[i    ] = value;
                    patternData.data[i + 1] = value;
                    patternData.data[i + 2] = value;
                    patternData.data[i + 3] = patternAlpha;
                }

                patternCtx.putImageData(patternData, 0, 0);
            }


            function draw() {
                if (ctx) {
                    ctx.clearRect(0, 0, viewWidth, viewHeight);
                    ctx.fillStyle = ctx.createPattern(patternCanvas, 'repeat');
                    ctx.fillRect(0, 0, viewWidth, viewHeight);
                }
            }

            function loop() {
                if (++frame % patternRefreshInterval === 0) {
                    update();
                    draw();
                }

                requestAnimationFrame(loop);
            }

            $(this).imagesLoaded( function () {
                initCanvas();
                initGrain();
                requestAnimationFrame(loop);
            });

            function resizeCanvas() {
                viewWidth = canvas.width = $this.width();
                viewHeight = canvas.height = $this.height();
                draw();
            }

            window.addEventListener('resize', resizeCanvas, false);
            $(this).resize(resizeCanvas);
        })
    }

    rdy.fxGlitchOverlay = function() {
        "use strict";

        $('.wpb_single_image .img-overlay.glitch').each(function(){

            var glitch = new GlitchFx();
             glitch.setImagePath($(this).data('img-src'), false);
            $(this).append(glitch.domElement);

        })


        $('#fancy-header .background-container.glitch').each(function(){

            if ($(this).hasClass('background-container') && !$(this).hasClass('fancy_parallax')) {
                var glitch = new GlitchFx();
                glitch.setImagePath($(this).data('original'), false);

                $(this).append(glitch.domElement);
            }

        })
    }

    rdy.fxGlitchOverlayHeader = function() {
        "use strict";

        $('#fancy-header .background-container.glitch').each(function(){

            var glitch = new GlitchFx();
            glitch.setImagePath($(this).data('original'), false);

            if ($(this).hasClass('background-container') && $(this).hasClass('fancy_parallax')) {
                $('.fancy_parallax-inner', $(this)).append(glitch.domElement);
            } else {
                $(this).append(glitch.domElement);
            }

        })
    }

    rdy.isotopeLayout = function() {
        "use strict";

        if ($('.iso-container').length > 0) {

            var itemQueue = [];
            var delayQueue = 300;
            var timerQueue;

            var isotopeContainersArray = [],
                filterItems = [];

            $('[class*="iso-container"]').each(function() {
                var isoData = $(this).data();
               isotopeContainersArray.push($(this));
            });


            var init_isotope = function() {

                for (var i = 0, len = isotopeContainersArray.length; i < len; i++) {
                    var $container = $(isotopeContainersArray[i]);

                    if($container.hasClass('type-height')) {
                        itemsAnimation($('.grid-item', $container), 0, false, $container);
                        continue
                    }

                    var this_container = $container;
                    init_isotope_container(this_container);
                }
            },
            init_isotope_container = function(this_container){
                imagesLoaded( this_container, function () {
                    var transitionDuration = this_container.data('items-animation') ? 0 : '0.4s';

                    if(this_container.hasClass('grid-blog') || this_container.hasClass('rdy-grid')){
                        this_container.isotope({
                            transitionDuration: transitionDuration,
                            itemSelector: '.grid-item',
                            layoutMode: 'fitRows',
                            fitRows: {
                                columnWidth: '.grid-sizer'
                            }
                        }).on('layoutComplete', onLayout(this_container, 0));
                    }else if(this_container.hasClass('rdy-masonry')){
                        this_container.isotope({
                            transitionDuration: transitionDuration,
                            itemSelector: '.grid-item',
                            masonry: {
                            }
                        }).on('layoutComplete', onLayout(this_container, 0));
                    }

                    /*if($('.rdy-portfolio-container').length && !rdyGlobals.isMobile){

                     this_container.one('layoutComplete',
                     function (event, laidOutItems) {
                     if(typeof pJSDom == 'object' && pJSDom.length){
                     jQuery.each(pJSDom, function(index, value) {
                     this.pJS.fn.particlesRefresh();
                     });
                     }
                     }
                     );

                     }*/

                    if(this_container.find('video').length){
                        this_container.find('video').on('loadedmetadata', function(){
                            this_container.isotope('layout');
                        })
                    }
                    this_container.isotope('layout');

                    setTimeout(function(){
                        $(window).trigger('resize');
                    }, 150);
                });

                //});

                $(window).on('debouncedresize', function() {
                    if(window.skrollr) skrollr.get().refresh();
                });
            },
            init_isotope_adv = function(){
                if( $('.rdy-portfolio-container.rdy-masonry-adv').length > 0 ){
                    var isInitIsotope = false;
                    var $container = $('.rdy-portfolio-container.rdy-masonry-adv');
                    $container.each(function () {
                        var this_container = $(this);

                        this_container.imagesLoaded( function () {

                            this_container.isotope({
                                transitionDuration: 0,
                                itemSelector: '.grid-item',
                                gutter: 0,
                                masonry: {
                                    columnWidth: '.grid-sizer'
                                }
                            }).on('layoutComplete', onLayout(this_container, 0));

                            isInitIsotope = true;
                            if(this_container.find('video').length){
                                this_container.find('video').on('loadedmetadata', function(){
                                    this_container.isotope('layout');
                                })
                            }
                            this_container.isotope('layout');

                        });


                        $(window).on( 'resize', function () {
                            var winWidth = window.innerWidth;
                            var columnNumb = 1;
                            var portfolioGutter = this_container.data('gutter') ? this_container.data('gutter') : 0;
                            var no_gutter = this_container.hasClass('no-gutter') ? 1 : 0;

                            var attr_col = this_container.attr('data-col');

                            var portfolioWidth = this_container.parent('.rdy_portfolio_wrap')[0].getBoundingClientRect().width;

                            if (portfolioGutter) {
                                this_container.parent('.rdy_portfolio_wrap').css({
                                    'margin-left': -(portfolioGutter + 15),
                                    'margin-right': -(portfolioGutter + 15),
                                })
                            }

                            if (winWidth >= 1466) {
                                if (typeof attr_col !== typeof undefined && attr_col !== false) {
                                    columnNumb = attr_col;
                                } else columnNumb = 3;

                                var postWidth = Math.floor(portfolioWidth / columnNumb);
                                this_container.find('.grid-item').each(function () {
                                    $(this).css( {
                                        width : postWidth - portfolioGutter * 2 + 'px',
                                        height : postWidth * 0.75 - portfolioGutter * 2 + 'px',
                                        margin : portfolioGutter + 'px'
                                    });
                                    if(no_gutter) $(this).css( {
                                        width : postWidth  + 'px',
                                        height : postWidth * 0.75  + 'px',
                                        margin : 0 + 'px'
                                    });
                                    if($(this).is('.wide')) $(this).css( {
                                        width : postWidth * 2 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.wide')) $(this).css( {
                                        width : postWidth * 2 + 'px'
                                    });
                                    if($(this).is('.tall')) $(this).css( {
                                        height : postWidth * 1.5 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.tall')) $(this).css( {
                                        height : postWidth * 1.5  + 'px'
                                    });
                                    if($(this).is('.wide-tall')) $(this).css( {
                                        width : postWidth * 2 - portfolioGutter * 2 + 'px',
                                        height : postWidth * 1.5 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.wide-tall')) $(this).css( {
                                        width : postWidth * 2 + 'px',
                                        height : postWidth * 1.5  + 'px'
                                    });
                                });

                            } else if (winWidth > 1024) {
                                if (typeof attr_col !== typeof undefined && attr_col !== false) {
                                    columnNumb = attr_col;
                                } else columnNumb = 3;

                                postWidth = Math.floor(portfolioWidth / columnNumb)

                                this_container.find('.grid-item').each(function () {
                                    $(this).css( {
                                        width : postWidth - portfolioGutter * 2 + 'px',
                                        height : postWidth * 0.75 - portfolioGutter * 2 + 'px',
                                        margin : portfolioGutter + 'px'
                                    });
                                    if(no_gutter) $(this).css( {
                                        width : postWidth  + 'px',
                                        height : postWidth * 0.75  + 'px',
                                        margin : 0 + 'px'
                                    });
                                    if($(this).is('.wide')) $(this).css( {
                                        width : postWidth * 2 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.wide')) $(this).css( {
                                        width : postWidth * 2 + 'px'
                                    });
                                    if($(this).is('.tall')) $(this).css( {
                                        height : postWidth * 1.5 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.tall')) $(this).css( {
                                        height : postWidth * 1.5  + 'px'
                                    });
                                    if($(this).is('.wide-tall')) $(this).css( {
                                        width : postWidth * 2 - portfolioGutter * 2 + 'px',
                                        height : postWidth * 1.5 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.wide-tall')) $(this).css( {
                                        width : postWidth * 2 + 'px',
                                        height : postWidth * 1.5  + 'px'
                                    });
                                });

                            } else if (winWidth > 767) {
                                var columnNumb = 3;
                                postWidth = Math.floor(portfolioWidth / columnNumb)
                                this_container.find('.grid-item').each(function () {
                                    $(this).css( {
                                        width : postWidth - portfolioGutter * 2 + 'px',
                                        height : postWidth * 0.75 - portfolioGutter * 2 + 'px',
                                        margin : portfolioGutter + 'px'
                                    });
                                    if(no_gutter) $(this).css( {
                                        width : postWidth  + 'px',
                                        height : postWidth * 0.75  + 'px',
                                        margin : 0 + 'px'
                                    });
                                    if($(this).is('.wide')) $(this).css( {
                                        width : postWidth * 2 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.wide')) $(this).css( {
                                        width : postWidth * 2 + 'px'
                                    });
                                    if($(this).is('.tall')) $(this).css( {
                                        height : postWidth * 1.5 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.tall')) $(this).css( {
                                        height : postWidth * 1.5  + 'px'
                                    });
                                    if($(this).is('.wide-tall')) $(this).css( {
                                        width : postWidth * 2 - portfolioGutter * 2 + 'px',
                                        height : postWidth * 1.5 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.wide-tall')) $(this).css( {
                                        width : postWidth * 2 + 'px',
                                        height : postWidth * 1.5  + 'px'
                                    });
                                });

                            }	else if (winWidth > 479) {
                                var columnNumb = 1;
                                postWidth = Math.floor(portfolioWidth / columnNumb)
                                this_container.find('.grid-item').each(function () {
                                    $(this).css( {
                                        width : postWidth - portfolioGutter * 2 + 'px',
                                        height : postWidth * 0.75 - portfolioGutter * 2 + 'px',
                                        margin : portfolioGutter + 'px'
                                    });
                                    if(no_gutter) $(this).css( {
                                        width : postWidth  + 'px',
                                        height : postWidth * 0.75  + 'px',
                                        margin : 0 + 'px'
                                    });
                                    if($(this).is('.wide')) $(this).css( {
                                        width : postWidth - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.wide')) $(this).css( {
                                        width : postWidth + 'px'
                                    });
                                    if($(this).is('.tall')) $(this).css( {
                                        height : postWidth * 1.5 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.tall')) $(this).css( {
                                        height : postWidth * 1.5  + 'px'
                                    });
                                    if($(this).is('.wide-tall')) $(this).css( {
                                        width : postWidth - portfolioGutter * 2 + 'px',
                                        height : postWidth * 0.75 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.wide-tall')) $(this).css( {
                                        width : postWidth  + 'px',
                                        height : postWidth * 0.75  + 'px'
                                    });
                                });

                            }

                            else if (winWidth <= 479) {
                                var columnNumb = 1;
                                postWidth = Math.floor(portfolioWidth / columnNumb)
                                this_container.find('.grid-item').each(function () {
                                    $(this).css( {
                                        width : postWidth - portfolioGutter * 2 + 'px',
                                        height : postWidth * 0.75 - portfolioGutter * 2 + 'px',
                                        margin : portfolioGutter + 'px'
                                    });
                                    if(no_gutter) $(this).css( {
                                        width : postWidth  + 'px',
                                        height : postWidth * 0.75  + 'px',
                                        margin : 0 + 'px'
                                    });
                                    if($(this).is('.wide')) $(this).css( {
                                        width : postWidth - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.wide')) $(this).css( {
                                        width : postWidth + 'px'
                                    });
                                    if($(this).is('.tall')) $(this).css( {
                                        height : postWidth * 1.5 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.tall')) $(this).css( {
                                        height : postWidth * 1.5  + 'px'
                                    });
                                    if($(this).is('.wide-tall')) $(this).css( {
                                        width : postWidth - portfolioGutter * 2 + 'px',
                                        height : postWidth * 0.75 - portfolioGutter * 2 + 'px'
                                    });
                                    if(no_gutter && $(this).is('.wide-tall')) $(this).css( {
                                        width : postWidth + 'px',
                                        height : postWidth * 0.75  + 'px'
                                    });
                                });

                            }

                            if(isInitIsotope){
                                if(this_container.find('video').length){
                                    this_container.find('video').on('loadedmetadata', function(){
                                        this_container.isotope('layout');
                                    })
                                }
                                this_container.isotope('layout');
                            }

                            return columnNumb;

                        }).resize();
                    });
                }
            },
            itemEffectAnimate = function ($item, $fx, $queue) {
                var $animation = "transition.fadeIn";

                if ($fx == 'fadeIn') {
                    $animation = "transition.fadeIn";
                } else if ($fx == 'slideUpBigIn') {
                    $animation = "transition.slideUpBigIn";
                } else if ($fx == 'expandIn') {
                    $animation = "transition.expandIn";
                }

                var speed;

                if ($queue) {
                    var duration = 750;
                    var delay = 0;
                } else {
                    var duration = 600;
                    var delay = 500;

                    if (speed == 'fast') {
                        duration = 900;
                        delay = 300;
                    }
                }

                $('> .hentry', $item).removeClass('fade-out').addClass('start_animation');
                $('> .hentry', $item).velocity('stop').velocity($animation, {
                    duration: duration,
                    delay: delay,
                    drag: true,
                    display: 'auto',
                    easing: [.17, .67, .83, .67]
                });
            },
            itemEffectQueue = function($fx){
                if (timerQueue) return
                timerQueue = window.setInterval(function () {
                    if (!itemQueue.length){
                        window.clearInterval(timerQueue)
                        timerQueue = null
                    }

                    if (itemQueue.length) {
                        var $item = $(itemQueue.shift());
                        itemEffectAnimate($item, $fx, true)
                        itemEffectQueue($fx)
                    }
                }, delayQueue)
            },

            setWaypoint = function($item, $type_animation, $queue, offset){
                $item.waypoint(function (direction) {
                    if ($queue) {
                        itemQueue.push(this)
                        itemEffectQueue($type_animation)
                    } else {
                        itemEffectAnimate($(this), $type_animation, false)
                    }
                }, {offset: offset, triggerOnce: true});
            },

            onLayout = function (container, startIndex, speed) {

                var $type_animation = container.data('items-animation');
                var $type_animation_queue = container.data('items-animation-queue');

                if ($type_animation) {
                    if($type_animation_queue){
                        var offset = '95%';
                    }else{
                        var offset = '85%';
                    }

                    $.each(container.find('.grid-item'), function (index, val) {
                        if ($(val).hasClass('do-animation')) {
                            setWaypoint($(val), $type_animation, $type_animation_queue, offset)

                        }
                    });
                }
            },

            itemsAnimation = function(items, startIndex, arrange, container) {
                var $allItems = items.length - startIndex,
                    showed = 0,
                    index = 0;

                var $type_animation = container.data('items-animation');
                var $type_animation_queue = container.data('items-animation-queue');

                if ($type_animation) {
                    if ($type_animation_queue) {
                        var offset = '95%';
                    } else {
                        var offset = '85%';
                    }

                    $.each(items, function (index, val) {
                        var $el;

                        if (arrange) {
                            $el = $(val.element)
                        } else {
                            $el = $(val)
                        }

                        setWaypoint($el, $type_animation, $type_animation_queue, offset)
                    });
                }
            },
            init_infinite = function(){
                var $containers = $('.infinite-scroll .iso-container');
                var is_masonry = $('.infinite-scroll .rdy-masonry, .infinite-scroll .rdy-grid').length ? true : false;
                var $container;

                if($containers.length > 0) {
                    $container = $($containers[0])

                    $container.infinitescroll({
                            navSelector: '.paginator .page-nav',
                            nextSelector: '.paginator .page-nav a:first',
                            itemSelector: '.grid-item',
                            animate: false,
                            maxPage: $('.paginator').data('max-pages'),
                            loading: {
                                finishedMsg: "",
                                msg: $('<div class="loader"><div class="circle"></div></div>'),
                                msgText: "",
                                selector: ".infinite-loading",
                                speed: 0
                            },
                            errorCallback: function () {
                                $(".infinite-loading, .rdy-load-more").hide(0);
                            }
                        },
                        function (newElements) {
                            var $newElems = jQuery(newElements);
                            $container.append($container.find('.grid-sizer'));

                            if (is_masonry) {
                                $newElems.imagesLoaded(function () {
                                    $container.isotope('appended', $newElems);
                                });

                                $(window).trigger('resize');
                            }

                            itemsAnimation(newElements, 0, false, $container);

                        }
                    );

                    if ($container.hasClass('load-button-style')) {
                        $(window).unbind('.infscr');
                        $('.rdy-load-more').click(function (e) {
                            e.preventDefault();
                            $container.infinitescroll('retrieve');
                            return false;
                        });
                    }
                }

            };

            $('.filter_portfolio').on('click', '.filter', function (event) {
                var $this = $(this),
                    filterItems = [];
                var $container = $this.parents('.filter_portfolio').next('.rdy-portfolio-container');
                var transitionDuration = $container.data().isotope.options.transitionDuration

                if (!$this.hasClass('.current')) {

                    window.clearInterval(timerQueue);
                    timerQueue = null
                    itemQueue = [];

                    $('> .grid-item', $container).waypoint('destroy')
                    $.each($('> .grid-item > .hentry', $container), function(index, val) {

                        if (transitionDuration == 0) {
                            $(val).velocity('stop').velocity('transition.expandOut', {
                                duration: 300,
                                drag: true,
                                display: 'auto',
                                easing: [.17, .67, .83, .67]
                            });
                        }
                    });


                    var $optionSet = $this.parents('.filter_holder');
                    $optionSet.find('.current').removeClass('current');
                    $this.addClass('current');

                    var selector = $(this).attr('data-filter');

                    setTimeout(function() {
                        $container.isotope({
                            filter: function() {
                                var block = $(this),
                                    filterable = (selector == '*') || block.hasClass(selector);
                                if (filterable) {
                                    filterItems.push(block);
                                }
                                return filterable;
                            }
                        });
                    }, 300);

                    if (transitionDuration == 0) {
                        $container.one('arrangeComplete', function( event, filteredItems ) {
                            setTimeout(function() {
                                itemsAnimation(filteredItems, 0, true, $container);
                            }, 100);
                        });
                    }

                    /*setTimeout(function () {
                        $container.isotope('layout');
                    }, 400);*/

                }

                event.preventDefault();
            });

            $('.rdy_gallery.hover-elem-cross .grid-item').hover(
                function() {
                    var $animation = { duration: 750, easing: [.19, 1, .22, 1], queue: false, }

                    $(this).find('.hover-element rect:eq(0)').velocity('stop').velocity(
                        {translateY: ['20px', 0]}, $animation
                    );
                    $(this).find('.hover-element rect:eq(1)').velocity('stop').velocity(
                        {translateX: ['-20px', 0]}, $animation
                    );
                    $(this).find('.hover-element rect:eq(2)').velocity('stop').velocity(
                        {translateY: ['-20px', 0]}, $animation
                    );
                    $(this).find('.hover-element rect:eq(3)').velocity('stop').velocity(
                        {translateX: ['20px', 0]}, $animation
                    );


                }, function() {
                    var $animation = { duration: 450, easing: [.19, 1, .22, 1], queue: false, }

                    $(this).find('.hover-element rect:eq(0)').velocity('stop').velocity(
                        {translateY: '0px'}, $animation
                    );
                    $(this).find('.hover-element rect:eq(1)').velocity('stop').velocity(
                        {translateX: '0px'}, $animation
                    );
                    $(this).find('.hover-element rect:eq(2)').velocity('stop').velocity(
                        {translateY: '0px'}, $animation
                    );
                    $(this).find('.hover-element rect:eq(3)').velocity('stop').velocity(
                        {translateX: '0px'}, $animation
                    );

                }
            );

            init_isotope();
            init_isotope_adv();
            init_infinite();
        }
    }

    rdy.can = {

        init: function(heightOverride){
            this.webGLTrue = !1;
            window.WebGLRenderingContext && (this.webGLTrue = !0);

            var canvasAsset = jQuery('.vc_row.rdy-canvas-effect');

            canvasAsset.each(function () {
                var $mobile_hide = false;
                if( $(this).data('fx-hide') == 'md' && window.innerWidth <= 992 ) {
                    $mobile_hide = true;
                } else if( $(this).data('fx-hide') == 'xs' && window.innerWidth < 768 ) {
                    $mobile_hide = true;
                }


                var uid = rdy_guid();
                if ($(this).data('type') === "motion") {
                    var ob = $(this).find('.fx-motion').prepend('<canvas id="' + uid + '"></canvas>');
                } else if ($(this).data('type') === 'shapes') {
                    var ob = $('<div class="row-canvas"><canvas id="' + uid + '"></canvas></div>');
                } else {
                    var ob = $('<div class="row-canvas" id="' + uid + '"></div>');
                }

                $(this).append(ob);

                if( !$mobile_hide ) {

                    if (!Detector.webgl && ($(this).data('type') === "particles" || $(this).data('type') === "motion")) {

                        if ($(this).data('fx-image')) {
                            ob.css('background-image', 'url(' + $(this).data('fx-image') + ')');
                        }

                    }else{

                        if ($(this).data('type') === "waves") {
                            rdy.can.initCircles(uid, ob, $(this), heightOverride);

                        } else if ($(this).data('type') === "spiderweb") {
                            rdy.can.initGeometry(uid, ob, $(this), heightOverride);

                        } else if ($(this).data('type') === "particles") {
                            rdy.can.initParticles(uid, ob, $(this), heightOverride);

                        } else if ($(this).data('type') === "sine_waves") {
                            rdy.can.initSineWaves(uid, ob, $(this), heightOverride);

                        } else if ($(this).data('type') === "motion") {
                            rdy.can.initMotion(uid, ob, $(this), heightOverride);

                            var debounceAdjust = debounce(function () {
                                if($(".vc_row.rdy-canvas-effect[data-type=\"motion\"]").length && this.webGLTrue) {
                                    $('.vc_row.rdy-canvas-effect[data-type=\"motion\"]').each( function () {
                                        resizeImage($(this));
                                    });
                                }
                            }, 50);
                            window.addEventListener("resize", debounceAdjust);

                        } else if ($(this).data('type') === 'shapes') {
                            rdy.can.initFlyingShapes(uid, ob, $(this), heightOverride);

                        }

                    }

                }
            });
        },

        initSineWaves: function(uid, ob, canvas, heightOverride) {
            var fx_preset = canvas.data('fx-preset') ? canvas.data('fx-preset') : "";
            var fx_color1 = canvas.data('fx-color1') ? canvas.data('fx-color1') : "";
            var fx_color2 = canvas.data('fx-color2') ? canvas.data('fx-color2') : "";
            var fx_color3 = canvas.data('fx-color3') ? canvas.data('fx-color3') : "";

            ob.append('<canvas></canvas>');

            container = document.getElementById( uid );

            var waves = [
                {
                    timeModifier: 3,
                    lineWidth: 1,
                    amplitude: -25,
                    wavelength: 125,

                },
                {
                    timeModifier: 2,
                    lineWidth: .72,
                    amplitude: -15,
                    wavelength: 75
                },
                {
                    timeModifier: 1,
                    lineWidth: .51,
                    amplitude: -20,
                    wavelength: 70
                },
                {
                    timeModifier: 0.5,
                    lineWidth: .51,
                    amplitude: -170,
                    wavelength: 200
                },
                {
                    timeModifier: 0.25,
                    lineWidth: .52,
                    amplitude: -100,
                    wavelength: 200
                }
            ];

            if (fx_preset == 'preset2') {
                waves = [
                    {
                        timeModifier: 3,
                        lineWidth: 3,
                        amplitude: -25,
                        wavelength: 125,

                    },
                    {
                        timeModifier: 2,
                        lineWidth: 1.72,
                        amplitude: -15,
                        wavelength: 75
                    },
                    {
                        timeModifier: 1,
                        lineWidth: 2.51,
                        amplitude: -20,
                        wavelength: 70
                    },
                    {
                        timeModifier: 0.5,
                        lineWidth: 1.51,
                        amplitude: -170,
                        wavelength: 200
                    },
                    {
                        timeModifier: 0.25,
                        lineWidth: 3.52,
                        amplitude: -100,
                        wavelength: 200
                    }
                ];
            }
            else if (fx_preset == 'preset3') {
                waves = [
                    {
                        timeModifier: 1.6,
                        lineWidth: 10,
                        amplitude: -60,
                        wavelength: 200,
                        segmentLength: 10,

                    }
                ];
            }

            var waves = new SineWaves({
                el: $('canvas', container).get(0),
                speed: 3,
                width: function() {
                    return $(container).width();
                },
                height: function() {
                    return $(container).height();
                },
                ease: 'SineInOut',
                wavesWidth: '106%',
                /*waves: ,*/
                waves: waves,

                // Called on window resize
                resizeEvent: function() {
                    var gradient = '';

                    if (fx_color1 && (fx_color2 || fx_color3)) {
                        gradient = this.ctx.createLinearGradient(0, 0, this.width, 0);

                        if (fx_color1) {
                            gradient.addColorStop(0, fx_color1);
                        }

                        if (fx_color2 && fx_color3) {
                            gradient.addColorStop(0.5, fx_color2);
                            gradient.addColorStop(1, fx_color3);
                        } else if (fx_color2) {
                            gradient.addColorStop(1, fx_color2);
                        } else if (fx_color3) {
                            gradient.addColorStop(1, fx_color3);
                        }
                    } else {
                        gradient = fx_color1 ? fx_color1 : fx_color2 ? fx_color2 : fx_color3 ? fx_color3 : '';
                    }

                    var index = -1;
                    var length = this.waves.length;
                    while(++index < length){
                        this.waves[index].strokeStyle = gradient;
                    }

                    // Clean Up
                    index = void 0;
                    length = void 0;
                    gradient = void 0;
                }
            });

        },

        initParticles: function(uid, ob, canvas, heightOverride) {

            var fx_auto = canvas.data('fx-auto') ? true : false;
            var fx_color = canvas.data('fx-color') ? canvas.data('fx-color') : "#ffffff";
            var fx_fog_color = canvas.data('fx-fog-color') ? canvas.data('fx-fog-color') : "#ffffff";
            var fx_mm_disable = false;

            container = document.getElementById( uid );

            var container, stats;
            var camera, scene, renderer, group, particle;
            var mouseX = 0, mouseY = 0;

            var windowHalfX = window.innerWidth / 2;
            var windowHalfY = window.innerHeight / 2;

            var WIDTH = $(container).width(),
                HEIGHT = $(container).height();
            var ANGLE = 45,
                ASPECT = WIDTH / HEIGHT,
                NEAR = 1,
                FAR = 3000,
                FIELD_OF_VIEW = 60,
                PARTICLES = fx_auto ? 1600 : 5000,
                PARTICLES_TOUCH = 3000,
                CAMERA_Z = 1300,
                // CAMERA_Z = 1000,
                FOG_DENSITY = 0.0008,
                HALF_HEIGHT = HEIGHT / 2,
                HALF_WIDTH = WIDTH / 2,
                BASE_PARTICLE_SIZE = 12,
                MOBILE_PARTICLE_SIZE = 14,
                PARTICLE_COUNT = rdyGlobals.isMobile ? PARTICLES_TOUCH : PARTICLES,
                PARTICLE_SIZE = rdyGlobals.isMobile ? MOBILE_PARTICLE_SIZE : BASE_PARTICLE_SIZE;


            init();
            animate();

            /*var particlesVS;
            var particlesPS;

            SHADER_LOADER.load({
                vertexShaders: [{name: 'particles', src: levelup_js_vars.themePath + "/assets/images/shaders/particles.vs"}],
                fragmentShaders: [{name: 'particles', src: levelup_js_vars.themePath + "/assets/images/shaders/particles.ps"}],
            },
                function (data)
                {
                    particlesVS = data.particles.vertex;
                    particlesPS = data.particles.fragment;

                    init();
                    animate();
                }
            );*/

            function init() {

                materials = [];
                positions = [];

                oddTick = false;
                camera = new THREE.PerspectiveCamera( ANGLE, ASPECT, NEAR, FAR );
                camera.position.z = CAMERA_Z;

                scene = new THREE.Scene();
                scene.fog = new THREE.FogExp2( fx_fog_color, FOG_DENSITY );

                geometry = new THREE.Geometry();
                var sprite = new THREE.TextureLoader().load( levelup_js_vars.themePath + "/assets/images/particle.png" );

                for ( var i = 0; i < PARTICLE_COUNT; i ++ ) {
                    var vertex = new THREE.Vector3();
                    vertex.x = Math.random() * 2200 - 1100;
                    vertex.y = Math.random() * 2200 - 1100;
                    vertex.z = Math.random() * 2200 - 1100;
                    // vertex.x = Math.random() * 2000 - 1000;
                    // vertex.y = Math.random() * 2000 - 1000;
                    // vertex.z = Math.random() * 2000 - 1000;

                    geometry.vertices.push( vertex );
                }

                parameters = [
                    [ 1 ]
                ];

                if (fx_auto) {
                    parameters = [
                        [5],
                        [4],
                        [3],
                        [2],
                        [1]
                    ];
                }

                for ( i = 0; i < parameters.length; i ++ ) {
                    color = fx_color;
                    materials[i] = new THREE.PointsMaterial( {
                        color: fx_color,
                        size: PARTICLE_SIZE,
                        map: sprite,
                        // alphaTest: 0.5,
                        blending: THREE.AdditiveBlending,
                        depthTest: false,
                        transparent: true
                    } );

                    particles = new THREE.Points( geometry, materials[i] );
                    particles.rotation.x = Math.random() * 3;
                    particles.rotation.y = Math.random() * 3;
                    particles.rotation.z = Math.random() * 3;
                    scene.add( particles );
                }

                renderer = new THREE.WebGLRenderer( { alpha: true } );
                renderer.setPixelRatio( window.devicePixelRatio );
                renderer.setSize( WIDTH, HEIGHT );
                container.appendChild( renderer.domElement );

                if(rdyGlobals.isMobile) {
                    window.addEventListener("deviceorientation", function (e) {
                        var x = e.gamma,
                            y = e.beta;

                        if (0 == window.orientation) {
                            mouseX = x * 30;
                            mouseY = (y - 30) * 30;
                        } else if (90 == window.orientation) {
                            mouseX = -y * 30;
                            mouseY = (-x - 30) * 30;
                        } else if (-90 == window.orientation) {
                            mouseX = y * 30;
                            mouseY = (x - 30) * 30;
                        }

                    });
                }

                if(!fx_mm_disable){
                    document.addEventListener( 'mousemove', onDocumentMouseMove, false );
                }

                window.addEventListener( 'resize', onWindowResize, false );

            }

            function onWindowResize() {
                container = document.getElementById( uid );
                var scene_width = $(container).width();
                var scene_height = $(container).height();

                windowHalfX = window.innerWidth / 2;
                windowHalfY = window.innerHeight / 2;
                sceneHalfX = scene_width / 2;
                sceneHalfY = scene_height / 2;

                camera.aspect = scene_width / scene_height;
                camera.updateProjectionMatrix();

                renderer.setSize( scene_width , scene_height );
            }

            function onDocumentMouseMove( event ) {
                mouseX = event.clientX - (window.innerWidth / 2);
                mouseY = event.clientY - (window.innerHeight / 2);
            }

            function animate() {
                requestAnimationFrame( animate );
                render();
            }

            function render() {

                var time = Date.now() * 0.00005;

                camera.position.x += ( mouseX - camera.position.x ) * 0.05;
                camera.position.y += ( - mouseY - camera.position.y ) * 0.05;
                camera.lookAt( scene.position );

                if (fx_auto) {
                    for (i = 0; i < scene.children.length; i++) {
                        var object = scene.children[i];
                        if (object instanceof THREE.Points) {
                            object.rotation.y += 0.001;
                        }
                    }
                }

                renderer.render(scene, camera);

            }

        },

        initCircles: function(uid, ob, canvas, heightOverride) {
            var fx_color = canvas.data('fx-color') ? canvas.data('fx-color') : "#ffffff";
            var fx_mm_disable = canvas.data('fx-mm-disable') ? true : false;

            container = document.getElementById( uid );

            var scene_width = $(container).width();
            var scene_height = $(container).height();

            var SEPARATION = 120, AMOUNTX = 50, AMOUNTY = 50;
            var camera, scene, renderer;
            var particles, particle, count = 0;
            var mouseX = 0, mouseY = 0;

            //if(fx_mm_disable){
            //    mouseX = -300;
            //    mouseY = -500;
            //}

            var windowHalfX = window.innerWidth / 2;
            var windowHalfY = window.innerHeight / 2;
            var sceneHalfX = scene_width / 2;
            var sceneHalfY = scene_height / 2;

            init();
            animate();


            function init(){
                camera = new THREE.PerspectiveCamera( 55, scene_width / scene_height, 1, 10000 );
                camera.position.z = 1000;
                scene = new THREE.Scene();
                particles = new Array();

                var PI2 = Math.PI * 2;
                var material = new THREE.SpriteCanvasMaterial( {
                    color: fx_color,
                    program: function ( context ) {
                        context.beginPath();
                        context.arc( 0, 0, 0.4, 0, PI2, true );
                        context.fill();
                    }
                } );

                var i = 0;

                for ( var ix = 0; ix < AMOUNTX; ix ++ ) {
                    for ( var iy = 0; iy < AMOUNTY; iy ++ ) {
                        particle = particles[ i ++ ] = new THREE.Sprite( material );
                        particle.position.x = ix * SEPARATION - ( ( AMOUNTX * SEPARATION ) / 2 );
                        particle.position.z = iy * SEPARATION - ( ( AMOUNTY * SEPARATION ) / 2 );
                        scene.add( particle );
                    }
                }

                renderer = new THREE.CanvasRenderer( { alpha: true } );
                renderer.setPixelRatio( window.devicePixelRatio );
                renderer.setSize( scene_width, scene_height );
                container.appendChild( renderer.domElement );

                if (rdyGlobals.isMobile) {
                    window.addEventListener("deviceorientation", function (e) {
                        var x = e.gamma,
                            y = e.beta;

                        if (0 == window.orientation) {
                            mouseX = x * 30;
                            mouseY = y * 10 - windowHalfY * 2;
                        } else if (90 == window.orientation) {
                            mouseX = -y * 30;
                            mouseY = (-x * 10) - windowHalfY * 2;
                        } else if (-90 == window.orientation) {
                            mouseX = y * 30;
                            mouseY = (x * 10) - windowHalfY * 2;
                        }

                    });
                }

                if(fx_mm_disable) {
                    camera.position.x = -400;
                    camera.position.y = 800;
                    camera.lookAt(scene.position);
                }

                if(!fx_mm_disable){
                    document.addEventListener( 'mousemove', onDocumentMouseMoveWave, false );
                }

                window.addEventListener( 'resize', onWindowResize, false );

            }

            function onWindowResize() {
                container = document.getElementById( uid );
                var scene_width = $(container).width();
                var scene_height = $(container).height();

                windowHalfX = window.innerWidth / 2;
                windowHalfY = window.innerHeight / 2;
                sceneHalfX = scene_width / 2;
                sceneHalfY = scene_height / 2;

                camera.aspect = scene_width / scene_height;
                camera.updateProjectionMatrix();

                renderer.setSize( scene_width , scene_height );
            }


            function onDocumentMouseMoveWave( event ) {
                mouseX = event.clientX - windowHalfX;
                mouseY = event.clientY - windowHalfY * 2.5;
            };


            function animate() {
                requestAnimationFrame( animate );
                render();
            };

            function render() {

                if(!fx_mm_disable) {
                    camera.position.x += ( mouseX - camera.position.x ) * .05;
                    camera.position.y += ( -mouseY - camera.position.y ) * .05;
                    camera.lookAt(scene.position);
                }

                var i = 0;

                for ( var ix = 0; ix < AMOUNTX; ix ++ ) {
                    for ( var iy = 0; iy < AMOUNTY; iy ++ ) {
                        particle = particles[ i++ ];
                        particle.position.y = ( Math.sin( ( ix + count ) * 0.3 ) * 50 ) +
                            ( Math.sin( ( iy + count ) * 0.5 ) * 50 );
                        particle.scale.x = particle.scale.y = ( Math.sin( ( ix + count ) * 0.3 ) + 1 ) * 4 +
                            ( Math.sin( ( iy + count ) * 0.5 ) + 1 ) * 4;
                    }
                }

                renderer.render( scene, camera );
                count += 0.1;
            }

        },

        initGeometry: function(uid, ob, canvas, heightOverride) {
            var fx_color = canvas.data('fx-color') ? canvas.data('fx-color') : "#ffffff";
            var fx_mm_disable = canvas.data('fx-mm-disable') ? true : false;

            particlesJS(uid, {
                "particles": {
                    "number": {
                        "value": 75,
                        "density": {
                            "enable": true,
                            "value_area": 800
                        }
                    },
                    "color": {
                        "value": fx_color
                    },
                    "shape": {
                        "type": "circle",
                        "stroke": {
                            "width": 0,
                            "color": "#000000"
                        },
                        "polygon": {
                            "nb_sides": 5
                        }
                    },
                    "opacity": {
                        "value": 0.3,
                        "random": false,
                        "anim": {
                            "enable": false,
                            "speed": 1,
                            "opacity_min": 0.1,
                            "sync": false
                        }
                    },
                    "size": {
                        "value": 3,
                        "random": true,
                        "anim": {
                            "enable": false,
                            "speed": 40,
                            "size_min": 0.1,
                            "sync": false
                        }
                    },
                    "line_linked": {
                        "enable": true,
                        "distance": 150,
                        "color": fx_color,
                        "opacity": 0.3,
                        "width": 1
                    },
                    "move": {
                        "enable": true,
                        "speed": 3,
                        "direction": "none",
                        "random": false,
                        "straight": false,
                        "out_mode": "out",
                        "bounce": false,
                        "attract": {
                            "enable": false,
                            "rotateX": 600,
                            "rotateY": 1200
                        }
                    }
                },
                "interactivity": {
                    "detect_on": "row",
                    "events": {
                        "onhover": {
                            "enable": fx_mm_disable ? false : true,
                            "mode": "grab"
                        },
                        "onclick": {
                            "enable": false,
                            "mode": "push"
                        },
                        "resize": true
                    },
                    "modes": {
                        "grab": {
                            "distance": 200,
                            "line_linked": {
                                "opacity": 0.5
                            }
                        },
                        "bubble": {
                            "distance": 400,
                            "size": 40,
                            "duration": 2,
                            "opacity": 8,
                            "speed": 3
                        },
                        "repulse": {
                            "distance": 200,
                            "duration": 0.4
                        },
                        "push": {
                            "particles_nb": 4
                        },
                        "remove": {
                            "particles_nb": 2
                        }
                    }
                },
                "retina_detect": true
            });

        },

        initMotion: function(uid, ob, container, heightOverride){

            function canvasWorkers() {
                workerPurpleX.postMessage({cmd: "start", value: -20}),
                    workerPurpleY.postMessage({cmd: "start", value: 20}),
                    workerGreenX.postMessage({cmd: "start", value: 0}),
                    workerGreenY.postMessage({cmd: "start", value: -30}),
                scale1 == seriously.transform("2d") || scale2 == seriously.transform("2d")
                || (
                    workerPurpleX.addEventListener("message", function (e) {
                        purpleTranslate[0] = e.data,
                            scale2.translate(purpleTranslate[0], purpleTranslate[1])
                    }, !1),

                        workerPurpleY.addEventListener("message", function (e) {
                            purpleTranslate[1] = e.data
                        }, !1),

                        workerGreenX.addEventListener("message", function (e) {
                            greenTranslate[0] = e.data,
                                scale1.translate(greenTranslate[0], greenTranslate[1])
                        }, !1),

                        workerGreenY.addEventListener("message", function (e) {
                            greenTranslate[1] = e.data
                        }, !1)
                )
            }

            function killWorkers() {
                workerPurpleX.postMessage({cmd: "stop"}),
                    workerPurpleY.postMessage({cmd: "stop"}),
                    workerGreenX.postMessage({cmd: "stop"}),
                    workerGreenY.postMessage({cmd: "stop"})
            }


            if(container.data('type') == 'motion'){
                img = container.find('.fx-motion img')[0];
                var seriousImg = new Image;
                seriousImg.src = img.src;

                $this = this;
                //seriousImg.onload = function(){
                    var canvas,
                        imgRatio,
                        seriously,
                        sourceImage,
                        layers,
                        edge,
                        blend1,
                        linearGreen,
                        scale1,
                        blend2,
                        linearPurple,
                        scale2,
                        blend3,
                        blend4,
                        blend5, target,
                        screenCaptured = !1,
                        animateable = !0,
                        popstate = !1,
                        isFourOhFour = !1,
                        inputReady = !0,
                        glitchExists = !1,
                        purpleTranslate = [],
                        position_old = .5,
                        workerPurpleX = new Worker(levelup_js_vars.themePath + "/assets/js/fx/worker_layer2X.js"),
                        workerPurpleY = new Worker(levelup_js_vars.themePath + "/assets/js/fx/worker_layer2Y.js"),
                        greenTranslate = [],
                        workerGreenX = new Worker(levelup_js_vars.themePath + "/assets/js/fx/worker_layer1X.js"),
                        workerGreenY = new Worker(levelup_js_vars.themePath + "/assets/js/fx/worker_layer1Y.js");

                    var imgLoaded, canvas, imgRatio;

                    canvas = document.getElementById(uid);

                    if (
                        seriously = new Seriously,
                            sourceImage = seriously.source(seriousImg),
                            target = seriously.target(canvas),
                            seriousImg.onload = function () {
                                imgLoaded = true;
                                imgRatio = img.width / img.height;
                                container.data('imgRatio', imgRatio);
                                resizeImage(container);
                                container.find('.fx-motion').addClass('loaded');

                                target.width = sourceImage.width;
                                target.height = sourceImage.height;
                                layers = seriously.effect("layers", 6);
                                layers.source0 = sourceImage;

                                if(container.data('fx-preset') == 'purple') {
                                    edge = seriously.effect("edge"),
                                        blend1 = seriously.effect("blend"),
                                        edge.source = sourceImage,
                                        blend1.bottom = layers.source0,
                                        blend1.top = edge,
                                        blend1.opacity = "0.15",
                                        blend1.mode = "overlay",
                                        layers.source1 = blend1,
                                        linearGreen = seriously.effect("linear-transfer"),
                                        scale1 = seriously.transform("2d"),
                                        blend2 = seriously.effect("blend"),
                                        linearGreen.source = sourceImage,
                                        linearGreen.intercept = [0, .45, .1, 0],
                                        scale1.source = linearGreen,
                                        scale1.scale(1.4),
                                        scale1.translate(0, -30),
                                        blend2.bottom = layers.source1,
                                        blend2.top = scale1,
                                        blend2.opacity = "0.7",
                                        blend2.mode = "normal",
                                        layers.source2 = blend2,
                                        linearPurple = seriously.effect("linear-transfer"),
                                        scale2 = seriously.transform("2d"),
                                        blend3 = seriously.effect("blend"),
                                        linearPurple.source = sourceImage,
                                        linearPurple.intercept = [.5, -.1, .7, 0],
                                        scale2.source = linearPurple,
                                        scale2.scale(1.125),
                                        scale2.translate(-20, 20),
                                        blend3.bottom = layers.source2,
                                        blend3.top = scale2,
                                        blend3.opacity = "0.5",
                                        blend3.mode = "normal",
                                        layers.source3 = blend3,
                                        blend4 = seriously.effect("blend"),
                                        blend4.bottom = layers.source3,
                                        blend4.top = linearPurple,
                                        blend4.opacity = "0.5",
                                        blend4.mode = "hardlight",
                                        layers.source4 = blend4,
                                        blend5 = seriously.effect("blend"),
                                        blend5.bottom = layers.source4,
                                        blend5.top = edge,
                                        blend5.opacity = "0.1",
                                        blend5.mode = "overlay",
                                        layers.source5 = blend5,
                                        target.source = layers,
                                        seriously.go()

                                }else if(container.data('fx-preset') == 'cooling_80'){
                                    var effect = seriously.effect('tone');
                                    effect.source = sourceImage;
                                    effect.light = [.70,1,1.90, 1];
                                    effect.dark = [0, .082,.2, 1];
                                    effect.toned = .6;
                                    effect.desat = 0;

                                }else if(container.data('fx-preset') == 'orange'){
                                    var effect = seriously.effect('tone');
                                    effect.source = sourceImage;
                                    effect.light = [1.3,.85,.45, 1];
                                    effect.dark = [.15,.08, .02, 1];
                                    effect.toned = .6;
                                    effect.desat = 0;

                                }else if(container.data('fx-preset') == 'green'){
                                    var effect = seriously.effect('tone');
                                    effect.source = sourceImage;
                                    effect.light = [0.7,1.1,.5, 1];
                                    effect.dark = [.01,.18, .01, 1];
                                    effect.toned = .6;
                                    effect.desat = 0;

                                }else if(container.data('fx-preset') == 'red'){
                                    var effect = seriously.effect('tone');
                                    effect.source = sourceImage;
                                    effect.light = [1.6,0.85, .95, 1];
                                    effect.dark = [.18, .01,.01, 1];
                                    effect.toned = .6;
                                    effect.desat = 0;

                                }else if(container.data('fx-preset') == 'deep_blue'){
                                    var effect = seriously.effect('tone');
                                    effect.source = sourceImage;
                                    effect.light = [.8,.98,1.65, 1];
                                    effect.dark = [.04, .05,.09, 1];
                                    effect.toned = .6;
                                    effect.desat = 0;

                                }else if(container.data('fx-preset') == 'underwatter'){
                                    var effect = seriously.effect('tone');
                                    effect.source = sourceImage;
                                    effect.light = [.75,1.1,1.05, 1];
                                    effect.dark = [.02, .06,.05, 1];
                                    effect.toned = .6;
                                    effect.desat = 0;

                                }else if(container.data('fx-preset') == 'grayscale'){
                                    var effect = seriously.effect('hue-saturation');
                                    effect.source = sourceImage;
                                    effect.saturation = -1;

                                }else if(container.data('fx-preset') == 'original'){
                                    var effect = sourceImage;
                                }

                                if(container.data('fx-preset') != 'purple') {
                                    layers.source1 = effect;

                                    scale1 = seriously.transform("2d");
                                    blend1 = seriously.effect("blend");

                                    scale1.source = effect,
                                        scale1.scale(1.1),
                                        scale1.translate(-40, 0),
                                        blend1.bottom = layers.source1,
                                        blend1.top = scale1,
                                        blend1.opacity = "0.14",
                                        blend1.mode = "normal",
                                        layers.source2 = blend1;

                                    scale2 = seriously.transform("2d"),
                                        blend2 = seriously.effect("blend"),
                                        scale2.source = effect,
                                        scale2.scale(1.2),
                                        scale2.translate(20, 10),
                                        blend2.bottom = layers.source2,
                                        blend2.top = scale2,
                                        blend2.opacity = "0.1",
                                        blend2.mode = "normal",
                                        layers.source3 = blend2;

                                    target.source = layers;
                                    seriously.go();
                                }

                            }, //canvasWorkers(),
                        !rdyGlobals.isMobile && $this.webGLTrue
                    ){
                        var purpleX, purpleY, greenX, greenY;

                        container.mousemove(function (e) {
                            if(!imgLoaded) return;

                            var x = e.clientX,
                                y = e.clientY,
                                halfWidth = img.width / 2,
                                halfHeight = img.height / 2;

                            purpleX = -15 * (x / halfWidth - 1) - 20;
                            purpleY = 15 * (y / halfHeight - 1) + 20;
                            greenX = 40 * (x / halfWidth - 1);
                            greenY = -40 * (y / halfHeight - 1) - 30;
                            workerPurpleX.postMessage({cmd: "stop"});
                            workerPurpleY.postMessage({cmd: "stop"});
                            workerGreenX.postMessage({cmd: "stop"});
                            workerGreenY.postMessage({cmd: "stop"});
                            scale1.translate(greenX, greenY);
                            scale2.translate(purpleX, purpleY);

                        });

                        $(canvas).mouseout(function (e) {
                            workerPurpleX.postMessage({cmd: "start", value: purpleX});
                            workerPurpleY.postMessage({cmd: "start", value: purpleY});
                            workerGreenX.postMessage({cmd: "start", value: greenX});
                            workerGreenY.postMessage({cmd: "start", value: greenY});

                        })

                    } else rdyGlobals.isMobile && window.DeviceOrientationEvent && this.webGLTrue && (killWorkers(),
                        window.addEventListener("deviceorientation", function (e) {
                            var x = e.gamma,
                                y = e.beta;

                            0 == window.orientation ? (scale1.translate(1.5 * x, 1.5 * y),
                                scale2.translate(.75 * x, .75 * y)) : 90 == window.orientation ? (scale1.translate(1.6 * y, -1.6 * x),
                                scale2.translate(.8 * y, x * -.8)) : -90 == window.orientation && (scale1.translate(-1.6 * y, 1.6 * x),
                                scale2.translate(y * -.8, .8 * x))
                        })),
                        window.addEventListener("orientationchange", function() {
                            resizeImage(container);
                        }, false);

                //} // onload
            }

        },
        
        initFlyingShapes: function (uid, ob, container, heightOverride) {
            "use strict";

            // PIXI.Point.subtract = function (a, b, out) {
            //
            //     if (typeof out === "undefined") { out = new PIXI.Point(); }
            //
            //     out.x = a.x - b.x;
            //     out.y = a.y - b.y;
            //
            //     return out;
            //
            // };

            var getClient = function () {
                var a, b = navigator.userAgent, c = b.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
                return /trident/i.test(c[1]) ? (a = /\brv[ :]+(\d+)/g.exec(b) || [], "IE " + (a[1] || "")) : "Chrome" === c[1] && (a = b.match(/\b(OPR|Edge)\/(\d+)/), null != a) ? a.slice(1).join(" ").replace("OPR", "Opera") : (c = c[2] ? [c[1], c[2]] : [navigator.appName, navigator.appVersion, "-?"], null != (a = b.match(/version\/(\d+)/i)) && c.splice(1, 1, a[1]), c)
            }
            function shuffle(a) {
                for (var b, c, d = a.length; d; b = Math.floor(Math.random() * d), c = a[--d], a[d] = a[b], a[b] = c);
                return a
            }

            window.requestAnimFrame = function () {
                return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (interval) { window.setTimeout(interval, 1e3 / 60) }
            }();

            window.cancelAnimationFrame = function () {
                return window.cancelAnimationFrame || window.mozCancelAnimationFrame
            }();

            var throttle = function (wait, func) {
                var c = null,
                    d = wait;
                !function () {
                    var a = func || this,
                        e = arguments,
                        f = Date.now();
                    (!c || f - c >= d) && (c = f, func.apply(a, e))
                }()
            }


            var canvasAnim = function (el, shapeColor, preset, size, speed, type) {
                this.canvasId = el,
                this.canvas = document.getElementById(this.canvasId),
                this.context = this.canvas.getContext("2d"),
                this.container = $(this.canvas).parent(),
                this.contHeight = this.container.height(),
                this.startPosY = this.contHeight + 100,
                this.client = getClient()[0].toLowerCase(),
                this.endPosY = -100,
                this.shapeColor = shapeColor ? shapeColor : '',
                this.preset = preset ? preset : '';
                this.size = size ? size : '';
                this.speed = speed ? speed : '';
                this.isSupportSVG = ("chrome" == this.client || "safari" == this.client) ? true : false;

                var $this = this;
                this.shapes = [],
                this.maxShapes = 15,//"chrome" == this.client ? 12 : 6,
                this.growSpeed = 10,
                this.maxwidth = 0,
                this.maxheight = 0,

                this.shapeDataPresets = {
                    'preset1': ["rectangle", "rectangle2", "triangle", "triangle2", "arc", "circle", "circle2", "cross", "line", "polygon", "zigzag", "tilda", "arc", "design1", "design2", "design3", "design4",  "design5", "design6", "design7"],//3
                    'preset2': ["rectangle", "rectangle2", "triangle", "triangle2", "arc", "circle", "circle2", "cross", "line", "polygon", "zigzag", "tilda", "arc", "ball", "bottle", "bug", "gift",  "heard", "horse"],
                    'preset3': ["rectangle", "rectangle2", "triangle", "triangle2", "arc", "circle", "circle2", "cross", "line", "polygon", "zigzag", "tilda", "arc", "camera", "game", "headphones", "projector",  "watch", "webcamera"],
                },
                this.svgImages = {
                    cross: { svg: "cross.svg", obj: new Image },
                    line: { svg: "line.svg", obj: new Image },
                    polygon: { svg: "polygon.svg", obj: new Image },
                    zigzag: { svg: "zig-zag.svg", obj: new Image },
                    tilda: { svg: "tilda.svg", obj: new Image },

                    design1: { svg: "design/design01.svg", obj: new Image },
                    design2: { svg: "design/design02.svg", obj: new Image },
                    design3: { svg: "design/design03.svg", obj: new Image },
                    design4: { svg: "design/design04.svg", obj: new Image },
                    design5: { svg: "design/design05.svg", obj: new Image },
                    design6: { svg: "design/design06.svg", obj: new Image },
                    design7: { svg: "design/design07.svg", obj: new Image },

                    ball: { svg: "kids/ball.svg", obj: new Image },
                    bottle: { svg: "kids/bottle.svg", obj: new Image },
                    bug: { svg: "kids/bug.svg", obj: new Image },
                    gift: { svg: "kids/gift.svg", obj: new Image },
                    heard: { svg: "kids/heard.svg", obj: new Image },
                    horse: { svg: "kids/horse.svg", obj: new Image },

                    camera: { svg: "fun/camera.svg", obj: new Image },
                    game: { svg: "fun/game.svg", obj: new Image },
                    headphones: { svg: "fun/headphones.svg", obj: new Image },
                    projector: { svg: "fun/projector.svg", obj: new Image },
                    watch: { svg: "fun/watch.svg", obj: new Image },
                    webcamera: { svg: "fun/webcamera.svg", obj: new Image },

                },
                this.order = [],
                this.type = type ? type : '';

                // Load shapes
                $.each(this.svgImages, function( index, value ) {
                    if ( "chrome" == $this.client || "safari" == $this.client ) {
                        if (value.svg) {
                            $.get(levelup_js_vars.themePath + "/assets/images/shapes/" + value.svg, function (a) {
                                var data = (new XMLSerializer).serializeToString(a);
                                value.obj.src = "data:image/svg+xml;charset=utf-8," + data;
                                value.obj = $this.changeSVGColor(value.obj, index);
                            });
                        }
                    } else {
                        if (value.img) {//value.path.indexOf(".png") > -1
                            value.obj.src = levelup_js_vars.themePath + "/assets/images/shapes/" + value.img;
                        }
                    }

                });

                for (var i = 0; this.maxShapes > i; i++)
                    this.order.push(i);

                this.order = shuffle(this.order),
                $(window).on("resize", function () {
                    throttle( 50, function () {
                        $this.respondCanvas()
                    })
                }),
                this.random = new PIXI.RandomDataGenerator,
                // this.renderer = new PIXI.CanvasRenderer(this.container.width(), this.container.height(), {view: this.canvas, antialias: true, transparent: true }),
                // this.stage = new PIXI.Container();
                // this.stage.interactive = true;

                // for (var i = 0; this.maxShapes > i; i++)
                //     this.addNewShape();
                this.addNewShape();
                this.respondCanvas();
                this.animate(!1)


            };

            canvasAnim.prototype = {
                init: function () {
                }, reset: function () {
                    this.shapes = [],
                    this.addNewShape(),
                    this.animate(!0)
                }, changeSVGColor: function (obj, shape) {
                    if ("" !== obj.src) {
                        var svg = $(obj.src.toString().replace("data:image/svg+xml;charset=utf-8,", "")),
                            paths = svg.find("path"),
                            rects = svg.find("rect");
                        // "polygon" == shape.shape ? paths.attr("stroke", this.tweenColor(tweenColor, 1)) : paths.attr("fill", this.tweenColor(tweenColor, 1));
                        // paths.attr("stroke", this.tweenColor(1, 1));
                        if (shape == "polygon") {
                            paths.attr("stroke", this.tweenColor(1, 1));
                        } else {
                            paths.attr("fill", this.tweenColor(1, 1));
                            rects.attr("fill", this.tweenColor(1, 1));
                        }

                        var image = new Image;
                        image.src = "data:image/svg+xml;charset=utf-8," + svg.prop("outerHTML")
                        obj = image
                    }
                    return obj;
                }, respondCanvas: function () {
                    var $this = this;
                    $(this.canvas).attr("width", $this.container.width()),
                    $(this.canvas).attr("height", $this.container.height()),
                    this.container = $(this.canvas).parent(),
                    this.contHeight = this.container.height(),
                    this.startPosY = this.contHeight + 100
                }, roundNum: function (a) {
                    return a = a > 1 ? 1 : a, a = 0 > a ? 0 : a, a.toFixed(2)
                }, tweenColor: function (a, hex) {
                    if (this.shapeColor)
                        return this.shapeColor;
                    var red, green, blue;
                    a = Math.abs(a - 1),
                    red = 165, green =122, blue = 235
                    var color = "rgba(" + red + "," + green + "," + blue + ",1)";
                    return 1 == hex && (color = this.rgbToHex(red, green, blue)), color
                }, componentToHex: function (color) {
                    var colorHex = color.toString(16);
                    return 1 == colorHex.length ? "0" + colorHex : colorHex
                }, rgbToHex: function (red, green, blue) {
                    return "#" + this.componentToHex(red) + this.componentToHex(green) + this.componentToHex(blue)
                }, drawSVGObj: function (shape, obj, context, rotation) {
                    context.translate(shape.x - shape.maxwidth / 2 * shape.scale, shape.y - shape.maxheight / 2 * shape.scale),
                    context.translate(shape.maxwidth / 2 * shape.scale, shape.maxheight / 2 * shape.scale),
                    context.rotate(rotation / 3.14),
                    context.drawImage(obj, -shape.maxwidth / 2 * shape.scale, -shape.maxheight / 2 * shape.scale, shape.maxwidth * shape.scale, shape.maxheight * shape.scale),

                    shape.scale < shape.maxscale && (shape.scale += shape.growth),
                    shape.scale > shape.maxscale && (shape.scale = shape.maxscale),
                    context.setTransform(1, 0, 0, 1, 0, 0)
                }, drawTriangle: function (shape, context, rotation) {
                    var d = shape.width * Math.sqrt(3) / 2;
                    context.translate(shape.x - shape.width / 2, shape.y),
                    context.translate(shape.width / 2, d / 2),
                    context.rotate(rotation / 3.14),
                    context.beginPath(),
                    context.moveTo(-shape.width / 2, -d / 2),
                    context.lineTo(shape.width / 2, -d / 2),
                    context.lineTo(0, d / 2),
                    context.lineTo(-shape.width / 2, -d / 2),
                    context.closePath();

                    var tweenColor = (shape.y / this.contHeight / 12 + .02, shape.y / this.contHeight);
                    context.lineWidth = shape.borderWidth,
                    context.strokeStyle = this.tweenColor(tweenColor),
                    context.stroke(),
                    context.setTransform(1, 0, 0, 1, 0, 0);

                    var shapeDimensions = shape;
                    shapeDimensions.height < shapeDimensions.maxheight && (shapeDimensions.height += shapeDimensions.growth),
                    shapeDimensions.width < shapeDimensions.maxwidth && (shapeDimensions.width += shapeDimensions.growth),
                    shapeDimensions.height > shapeDimensions.maxheight && (shapeDimensions.height = shapeDimensions.maxheight),
                    shapeDimensions.width > shapeDimensions.maxwidth && (shapeDimensions.width = shapeDimensions.maxheight)
                }, drawRectangle: function (shape, context, rotation) {
                    context.translate(shape.x - shape.width / 2, shape.y),
                    context.translate(shape.width / 2, shape.height / 2),
                    context.rotate(rotation / 3.14),
                    context.beginPath(),
                    context.rect(-shape.width / 2, -shape.height / 2, shape.width, shape.height),
                    context.lineWidth = shape.borderWidth;

                    var tweenColor = (shape.y / this.contHeight / 12 + .02, shape.y / this.contHeight);
                    context.strokeStyle = this.tweenColor(tweenColor), context.stroke(), context.setTransform(1, 0, 0, 1, 0, 0);

                    var shapeDimensions = shape;
                    shapeDimensions.height < shapeDimensions.maxheight && (shapeDimensions.height += shapeDimensions.growth),
                    shapeDimensions.width < shapeDimensions.maxwidth && (shapeDimensions.width += shapeDimensions.growth),
                    shapeDimensions.height > shapeDimensions.maxheight && (shapeDimensions.height = shapeDimensions.maxheight),
                    shapeDimensions.width > shapeDimensions.maxwidth && (shapeDimensions.width = shapeDimensions.maxheight)
                }, canvasAnim: function (shape, context, rotation) {
                    var d = shape.width * Math.sqrt(3) / 2;
                    context.translate(shape.x - shape.width / 2, shape.y),
                    context.translate(shape.width / 2, d / 2),
                    context.rotate(rotation / 3.14),
                    context.beginPath(),
                    context.moveTo(-shape.width / 2, -d / 2),
                    context.lineTo(shape.width / 2, -d / 2),
                    context.lineTo(0, d / 2),
                    context.lineTo(-shape.width / 2, -d / 2),
                    context.closePath();
                    shape.y / this.contHeight / 12 + .02;
                    context.lineWidth = shape.borderWidth;

                    var e = shape.y / this.contHeight;
                    context.strokeStyle = this.tweenColor(e),
                    context.stroke(),
                    context.setTransform(1, 0, 0, 1, 0, 0);

                    var shapeDimensions = shape;
                    shapeDimensions.height < shapeDimensions.maxheight && (shapeDimensions.height += shapeDimensions.growth),
                    shapeDimensions.width < shapeDimensions.maxwidth && (shapeDimensions.width += shapeDimensions.growth),
                    shapeDimensions.height > shapeDimensions.maxheight && (shapeDimensions.height = shapeDimensions.maxheight),
                    shapeDimensions.width > shapeDimensions.maxwidth && (shapeDimensions.width = shapeDimensions.maxheight)
                }, drawArc: function (shape, context, rotation) {
                    var d = shape.width / 2, e = 0, f = .8 * Math.PI, g = !1;
                    context.translate(shape.x - shape.width / 2, shape.y),
                    context.translate(shape.width / 3, shape.width / 4),
                    context.rotate(rotation / 3.14),
                    context.beginPath(),
                    context.arc(-shape.width / 3, -shape.width / 4, d, e, f, g);

                    shape.y / this.contHeight / 12 + .02;
                    context.lineWidth = shape.borderWidth;

                    var h = shape.y / this.contHeight;
                    context.strokeStyle = this.tweenColor(h),
                    context.stroke(),
                    context.setTransform(1, 0, 0, 1, 0, 0);

                    var shapeDimensions = shape;
                    shapeDimensions.height < shapeDimensions.maxheight && (shapeDimensions.height += shapeDimensions.growth),
                    shapeDimensions.width < shapeDimensions.maxwidth && (shapeDimensions.width += shapeDimensions.growth),
                    shapeDimensions.height > shapeDimensions.maxheight && (shapeDimensions.height = shapeDimensions.maxheight),
                    shapeDimensions.width > shapeDimensions.maxwidth && (shapeDimensions.width = shapeDimensions.maxheight)
                }, drawCircle: function (shape, context) {
                    var radius = shape.width,
                        startAngle = 0,
                        endAngle = Math.PI + 3 * Math.PI / 2,
                        anticlockwise = !1;
                    context.beginPath(),
                    context.arc(shape.x - shape.width / 2, shape.y, radius, startAngle, endAngle, anticlockwise);
                    shape.y / this.contHeight / 12 + .02;
                    context.lineWidth = shape.borderWidth;
                    var tweenColor = this.roundNum(shape.y / this.contHeight);
                    context.strokeStyle = this.tweenColor(tweenColor), context.stroke();
                    var shapeDimensions = shape;
                    shapeDimensions.height < shapeDimensions.maxheight && (shapeDimensions.height += shapeDimensions.growth),
                    shapeDimensions.width < shapeDimensions.maxwidth && (shapeDimensions.width += shapeDimensions.growth),
                    shapeDimensions.height > shapeDimensions.maxheight && (shapeDimensions.height = shapeDimensions.maxheight),
                    shapeDimensions.width > shapeDimensions.maxwidth && (shapeDimensions.width = shapeDimensions.maxheight)
                }, animate: function (loop) {
                    var $this = this;

                    this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
                    for (var i = 0; this.shapes.length > i; i++) {
                        var shape = this.shapes[i];

                        if(this.type == 'type2'){

                            var particlePositionVector = new rdy.PIXI.Point(shape.x, shape.y),
                                particleSpawnVector = new rdy.PIXI.Point(shape.spawn.x, shape.spawn.y),
                                distanceToSpawn = rdy.PIXI.Point.subtract(particlePositionVector, particleSpawnVector),
                                translationSpeed = .1,
                                maxDistance = 50;

                            if (1 === shape.direction.x) {
                                if (distanceToSpawn.x > maxDistance) {
                                    shape.direction.x = 0
                                } else {
                                    shape.x = shape.x + $this.random.realInRange(0, translationSpeed)
                                }
                            } else {
                                if (distanceToSpawn.x < -maxDistance) {
                                    shape.direction.x = 1
                                } else {
                                    shape.x = shape.x - $this.random.realInRange(0, translationSpeed)
                                }

                            }

                            if (1 === shape.direction.y) {
                                if (distanceToSpawn.y > maxDistance) {
                                    shape.direction.y = 0
                                } else {
                                    shape.y = shape.y + $this.random.realInRange(0, translationSpeed)
                                }
                            } else {
                                if(distanceToSpawn.y < -maxDistance){
                                    shape.direction.y = 1
                                } else {
                                    shape.y = shape.y - $this.random.realInRange(0, translationSpeed)
                                }
                            }


                            if (this.shapes[i].y > this.endPosY) {
                                // this.shapes[i].y = this.shapes[i].y - this.shapes[i].travelSpeed,
                                this.shapes[i].rotation = this.shapes[i].rotation + this.shapes[i].rotationSpeed * this.shapes[i].rotationDirection
                            } else {
                                // this.shapes[i].y = this.startPosY,
                                // this.shapes[i].x = Math.floor(Math.random() * this.container.width()),
                                this.shapes[i].rotation = Math.random()
                            }

                        } else {

                            if (this.shapes[i].y > this.endPosY) {
                                this.shapes[i].y = this.shapes[i].y - this.shapes[i].travelSpeed,
                                    this.shapes[i].rotation = this.shapes[i].rotation + this.shapes[i].rotationSpeed * this.shapes[i].rotationDirection
                            } else {
                                this.shapes[i].y = this.startPosY,
                                    this.shapes[i].x = Math.floor(Math.random() * this.container.width()),
                                    this.shapes[i].rotation = Math.random()
                            }

                        }


                        if ("rectangle" == this.shapes[i].shape)
                            this.drawRectangle(this.shapes[i], this.context, this.shapes[i].rotation)

                        else if ("rectangle2" == this.shapes[i].shape)
                            this.drawRectangle(this.shapes[i], this.context, this.shapes[i].rotation)

                        else if ("triangle" == this.shapes[i].shape)
                            this.drawTriangle(this.shapes[i], this.context, this.shapes[i].rotation)

                        else if ("triangle2" == this.shapes[i].shape)
                            this.drawTriangle(this.shapes[i], this.context, this.shapes[i].rotation)

                        else if ("arc" == this.shapes[i].shape)
                            this.drawArc(this.shapes[i], this.context, this.shapes[i].rotation)

                        else if ("circle" == this.shapes[i].shape)
                            this.drawCircle(this.shapes[i], this.context, this.shapes[i].rotation)

                        else if ("circle2" == this.shapes[i].shape)
                            this.drawCircle(this.shapes[i], this.context, this.shapes[i].rotation)

                        else if (!this.isSupportSVG) {
                            if (typeof $this.svgImages[this.shapes[i].shape].obj.naturalWidth !== "undefined" && $this.svgImages[this.shapes[i].shape].obj.naturalWidth > 0) {
                                this.drawSVGObj(this.shapes[i], $this.svgImages[this.shapes[i].shape].obj, this.context, this.shapes[i].rotation);
                            }
                        } else {
                            if (typeof $this.svgImages[this.shapes[i].shape] !== 'undefined') {
                                this.drawSVGObj(this.shapes[i], $this.svgImages[this.shapes[i].shape].obj, this.context, this.shapes[i].rotation);
                            }
                        }

                    }

                    this.shapes.length < this.maxShapes && this.addNewShape(),
                    loop || requestAnimFrame(function () {
                        $this.animate()
                    })
                }, addNewShape: function () {
                    var //count = 13,//"chrome" == this.client ? 13 : 4,
                        num = this.shapes.length,
                        rnd,
                        //rnd = Math.floor(Math.random() * count),
                        shape = "",
                        maxwidth = 0,
                        maxheight = 0,
                        borderWidth = 14,
                        maxscale = 1,
                        y = this.container.height() / this.maxShapes,
                        x = this.container.width() / this.maxShapes;

                    if (this.preset && typeof this.shapeDataPresets[this.preset] != "undefined") {
                        rnd = Math.floor(Math.random() * this.shapeDataPresets[this.preset].length);
                        shape = this.shapeDataPresets[this.preset][rnd];
                    } else {
                        // shape = this.shapeData[rnd].shape ? this.shapeData[rnd].shape : shape;
                        rnd = Math.floor(Math.random() * this.shapeDataPresets["preset1"].length);
                        shape = this.shapeDataPresets["preset1"][rnd];
                    }

                    var size_1 = 50;
                    var size_2 = 40;

                    if (this.size == 'large') {
                        size_1 = 70;
                        size_2 = 40;
                    }
                    var p_size_1 = 20;
                    var p_size_2 = 20;

                    if (this.size == 'large') {
                        p_size_1 = 30;
                        p_size_2 = 30;
                    }


                    if (shape == "rectangle") {
                        maxwidth = p_size_2 * Math.random() + p_size_1, maxheight = maxwidth, borderWidth = 3
                    }
                    else if (shape == "rectangle2") {
                        maxwidth = p_size_2 * Math.random() + p_size_1, maxheight = maxwidth
                    }
                    else if (shape == "triangle") {
                        maxwidth = p_size_2 * Math.random() + p_size_1, maxheight = maxwidth
                    }
                    else if (shape == "triangle2") {
                        maxwidth = p_size_2 * Math.random() + p_size_1, maxheight = maxwidth, borderWidth = 3
                    }
                    else if (shape == "arc") {
                        maxwidth = p_size_2 * Math.random() + p_size_1, maxheight = maxwidth
                    }
                    else if (shape == "circle") {
                        maxwidth = p_size_2 * Math.random() + p_size_1, maxheight = maxwidth, borderWidth = 18
                    }
                    else if (shape == "circle2") {
                        maxwidth = p_size_2 * Math.random() + p_size_1, maxheight = maxwidth, borderWidth = 3
                    }
                    else if (shape == "cross") {
                        maxwidth = 10 * Math.random() + 24, maxheight = maxwidth, borderWidth = 18
                    }
                    else if (shape == "line") {
                        maxwidth = 10 * Math.random() + 30, maxheight = .75 * maxwidth, borderWidth = 18
                    }
                    else if (shape == "polygon") {
                        maxwidth = 38 * Math.random() + 60, maxheight = .94898 * maxwidth, borderWidth = 18
                    }
                    else if (shape == "tilda") {
                        maxwidth = 10 * Math.random() + 23, maxheight = .3939393939393939 * maxwidth, borderWidth = 18
                    }
                    else if (shape == "zigzag") {
                        maxwidth = 20 * Math.random() + 43, maxheight = .619 * maxwidth, borderWidth = 18
                    }

                    else if (shape == "design3") {
                        maxwidth = 20 * Math.random() + 35, maxheight = maxwidth, borderWidth = 18
                    }
                    else if (shape == "design5") {
                        maxwidth = 20 * Math.random() + 50, maxheight = maxwidth, borderWidth = 18
                    }
                    else if (shape == "design6") {
                        maxwidth = 20 * Math.random() + 40, maxheight = maxwidth, borderWidth = 18
                    }
                    else if ([ 'design1', 'design2', 'design3', 'design4', 'design5', 'design6', 'design7',
                            "ball", "bottle", "bug", "gift",  "heard", "horse",
                            "camera", "game", "headphones", "projector", "watch", "webcamera" ].indexOf(shape) >= 0) {
                        maxwidth = size_2 * Math.random() + size_1, maxheight = maxwidth, borderWidth = 18
                    }


                    var travelSpeed;

                    if (this.speed == 'fast') {
                        travelSpeed = Math.random() / 1 + .1;
                    } else {
                        travelSpeed = Math.random() / 5 + .1;
                    }


                    var xx = num * x + 50;
                    var yy = this.order[num] * y + 50;


                    var shape = {
                        x: xx,
                        y: yy,
                        shape: shape,
                        rotation: 10 * Math.random() + 1,
                        width: 0,
                        height: 0,
                        scale: 0,
                        maxscale: maxscale,
                        maxwidth: maxwidth,
                        maxheight: maxheight,
                        borderWidth: borderWidth,
                        growth: Math.random() * this.growSpeed,
                        rotationSpeed: Math.random() / 80 + .01,
                        rotationDirection: 1 - 2 * Math.floor(Math.random()),
                        travelSpeed: travelSpeed,
                        particle: '',
                        direction: {
                            x: Math.round(Math.random()),
                            y: Math.round(Math.random())
                        },
                        spawn: {x: xx, y: yy}
                    }

                    this.shapes.push(shape);
                }
            }

            var canvasObj = new canvasAnim(uid, container.data('fx-color'), container.data('fx-preset'), container.data('fx-shape-size'), container.data('fx-shape-speed'), container.data('fx-shape-type'));

            if (container.data('lb-opacity')) {
                var opacity = container.data('lb-opacity') ? container.data('lb-opacity') : '.5';
                $('canvas', ob).css('opacity', opacity);
            }

        }

    };

    rdy.carousel = function (container) {
        var $owlSelector = $('[class*="owl-carousel"]:not(.owl-testimonials):not(.products)', container),
            params = {},
            tempTimeStamp,
            currentIndex;

        $owlSelector.each(function () {
            var params = {};
            var itemID = $(this).attr('id'),
                $elSelector = $(this);
            params['id'] = itemID;
            params['items'] = 4;
            params['columns'] = 3;
            params['fade'] = false;
            params['nav'] = false;
            params['navmobile'] = false;
            params['navskin'] = 'light';
            params['navspeed'] = 400;
            params['dots'] = false;
            params['dotsmobile'] = false;
            params['loop'] = false;
            params['autoplay'] = false;
            params['timeout'] = 3000;
            params['autoheight'] = false;
            params['hoverpause'] = false;
            params['margin'] = 0;
            params['lg'] = 1;
            params['md'] = 1;
            params['sm'] = 1;

            $.each($(this).data(), function (i, v) {
                params[i] = v;
            });

            $elSelector.on('initialized.owl.carousel', function (event) {

                var thiis = $(event.currentTarget);

                if ($(event.currentTarget).data('autoplay')) {
                    $(event.currentTarget).trigger('play.owl.autoplay');
                }

                setTimeout(function () {
                    animate_thumb($('.t-inside', el), event);
                }, 400);


                var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
                    currentIndex = $(currentItem).attr('data-index');

                $.each($('.owl-item:not(.active)', event.currentTarget), function (index, val) {
                    if ($(val).attr('data-index') != currentIndex) {
                        $('.start_animation:not(.t-inside)', val).removeClass('start_animation');
                    }
                    if ($(val).attr('data-index') == currentIndex) {
                        $('.animate_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
                    }
                });

                var el = $(event.currentTarget);

            });


            $elSelector.on('translated.owl.carousel', function (event) {

                var currentItem = $(event.currentTarget).find("> .owl-stage-outer > .owl-stage > .owl-item")[event.item.index],
                    currentIndex = $(currentItem).attr('data-index');

                setTimeout(function () {
                    var lastDelayElems = animate_elems($('.owl-item.active', event.currentTarget));
                    var lastDelayThumb = animate_thumb($('.owl-item.active .t-inside', event.currentTarget), event);

                    if ($(event.currentTarget).closest('.owl-slider').length && $(event.currentTarget).data('autoplay')) {
                        if (lastDelayElems == undefined) lastDelayElems = 0;
                        if (lastDelayThumb == undefined) lastDelayThumb = 0;
                        var maxDelay = Math.max(lastDelayElems, lastDelayThumb);
                        $(event.currentTarget).trigger('stop.owl.autoplay');
                        setTimeout(function () {
                            if (!$(event.currentTarget).hasClass('owl-mouseenter') && $(event.currentTarget).data('stopped') != 'true') $(event.currentTarget).trigger('play.owl.autoplay');
                        }, maxDelay);
                    }
                }, 200);

                $.each($('.owl-item:not(.active) .start_animation', $(event.target)), function (index, val) {
                    if ($(val).closest('.owl-slider').length) {
                        $(val).removeClass('start_animation');
                    }
                });

                $.each($('.owl-item:not(.active)', event.currentTarget), function (index, val) {
                    if ($(val).attr('data-index') != currentIndex) {
                        $('.start_animation:not(.t-inside)', val).removeClass('start_animation');
                    }
                    if ($(val).attr('data-index') == currentIndex) {
                        $('.animate_when_almost_visible:not(.t-inside)', val).addClass('start_animation');
                    }
                });

            });


            $elSelector.owlCarousel({
                items: params['items'],
                animateOut: (params['fade'] == true) ? 'fadeOut' : null,
                nav: params['nav'],
                dots: params['dots'],
                loop: params['loop'],
                margin: 0,
                video: true,
                autoWidth: false,
                autoplay: false,
                autoplayTimeout: params['timeout'],
                autoplaySpeed: params['navspeed'],
                autoplayHoverPause: params['hoverpause'],
                autoHeight: ($(this).hasClass('owl-height-equal') || $(this).hasClass('owl-height-auto')) ? true : params['autoheight'],
                rtl: $('body').hasClass('rtl') ? true : false,
                fluidSpeed: true,
                navSpeed: params['navspeed'],
                navContainer: params['nav'] ? $elSelector : false,
                responsiveClass: true,
                responsive: {
                    0: {
                        items: params['sm'],
                        nav: params['navmobile'],
                        dots: params['dotsmobile']
                    },
                    480: {
                        items: params['sm'],
                        nav: params['navmobile'],
                        dots: params['dotsmobile']
                    },
                    570: {
                        items: params['md'],
                        nav: params['navmobile'],
                        dots: params['dotsmobile']
                    },
                    960: {
                        items: params['lg']
                    }
                },
            });

        });

        function animate_elems($this) {
            var lastDelay;
            $.each($('.animate_when_almost_visible:not(.t-inside)', $this), function (index, val) {
                var element = $(val),
                    delayAttr = element.attr('data-delay');
                if (delayAttr == undefined) delayAttr = 0;
                setTimeout(function () {
                    element.addClass('start_animation');
                }, delayAttr);
                lastDelay = delayAttr;
            });
            return lastDelay;
        }

        function animate_thumb(items, event) {
            var lastDelay,
                itemIndex,
                tempIndex = ($(event.currentTarget).data('tempIndex') == undefined) ? $('.owl-item.active', event.currentTarget).first().index() : $(event.currentTarget).data('tempIndex'),
                numActives = $('.owl-item.active', event.currentTarget).length;
            $(event.currentTarget).data('tempIndex', event.item.index);
            $.each(items, function (index, val) {
                var parent = $(val).closest('.owl-item');
                if (!$(val).hasClass('start_animation')) {
                    if (parent.hasClass('active')) {

                        $(val).waypoint(function (direction) {
                            var element = $(this),
                                delayAttr = parseInt(element.attr('data-delay')),
                                itemIndex = element.closest('.owl-item').index() + 1,
                                diffItem = Math.abs(itemIndex - tempIndex) - 1;
                            if (itemIndex > tempIndex) {
                                $(event.currentTarget).data('tempIndex', itemIndex);
                            }
                            if (isNaN(delayAttr)) delayAttr = 100;
                            $('.owl-item.cloned[data-index="' + (element.closest('.owl-item').data('index')) + '"] .t-inside', event.currentTarget).addClass('start_animation');
                            var objTimeout = setTimeout(function () {
                                element.addClass('start_animation');
                            }, diffItem * delayAttr);
                            lastDelay = diffItem * delayAttr;
                            parent.data('objTimeout', objTimeout);

                        }, {offset: '90%', triggerOnce: true});

                    }
                }
            });
            return lastDelay;
        }
    };

})(jQuery);

Zerion Mini Shell 1.0