(function(a) {
    a(window).on("load", function() {
        a("#status").fadeOut();
        a("#preloader").delay(350).fadeOut("slow");
        a("body").delay(350).css({
            overflow: "visible"
        })
    });
    skrollr.init({
        smoothScrolling: true
    });
    var h = a(".video");
    if (h.length > 0) {
        h.magnificPopup({
            type: "iframe",
            iframe: {
                markup: '<style>.mfp-iframe-holder .mfp-content {max-width: 900px;height:500px}</style><div class="mfp-iframe-scaler" ><div class="mfp-close"></div><iframe class="mfp-iframe" frameborder="0" allowfullscreen></iframe></div></div>'
            }
        })
    }
    var b = a(".counter");
    if (b.length > 0) {
        b.counterUp({
            delay: 20,
            time: 3000
        })
    }
    var g = a(".swiper-container");
    if (g.length > 0) {
        var o = new Swiper(g, {
            effect: "coverflow",
            loop: true,
            centeredSlides: true,
            autoplay: 2000,
            speed: 2000,
            slidesPerView: "auto",
            coverflow: {
                rotate: 0,
                stretch: 80,
                depth: 200,
                modifier: 1,
                slideShadows: false,
            }
        })
    }
    var f = a(".parallaxie");
    if (f.length > 0) {
        f.parallaxie({
            speed: 0.975
        })
    }
    var n = a(".quote-wrapper");
    if (n.length > 0) {
        n.owlCarousel({
            loop: true,
            autoplayTimeout: 3500,
            nav: false,
            margin: 20,
            responsive: {
                320: {
                    items: 1
                },
                681: {
                    items: 2
                },
                991: {
                    items: 3
                },
                1200: {
                    items: 4
                },
                1920: {
                    items: 5
                }
            }
        })
    }
    var r = a(".tools-carousel");
    if (r.length > 0) {
        r.owlCarousel({
            loop: true,
            autoplay: true,
            autoplayTimeout: 1000,
            autoWidth: true,
            nav: false,
            responsive: {
                320: {
                    items: 2
                },
                681: {
                    items: 4
                },
                991: {
                    items: 6
                },
                1200: {
                    items: 8
                }
            }
        })
    }
    new WOW().init();
    if (a(".mailchimp").length > 0) {
        a(".mailchimp").ajaxChimp({
            language: "es",
            callback: l,
            url: ""
        })
    }

    function l(d) {
        if (d.result === "success") {
            a(".subscription-success").html(d.msg).fadeIn(1000);
            a(".subscription-error").fadeOut(500)
        } else {
            if (d.result === "error") {
                a(".subscription-error").html(d.msg).fadeIn(1000)
            }
        }
    }
    a.ajaxChimp.translations.es = {
        submit: "Submitting...",
        0: "We have sent you a confirmation email",
        1: "Please enter a value",
        2: "An email address must contain a single @",
        3: "The domain portion of the email address is invalid (the portion after the @: )",
        4: "The username portion of the email address is invalid (the portion before the @: )",
        5: "This email address looks fake or invalid. Please enter a real email address"
    };
    var c = a(".right-nav a, .demo a");
    if (c.length > 0) {
        c.on("click", function(d) {
            a(document).off("scroll");
            if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") || location.hostname == this.hostname) {
                var t = a(this.hash),
                    m = a(".navbar").height() - 2;
                t = t.length ? t : a("[name=" + this.hash.slice(1) + "]");
                if (t.length) {
                    a("html,body").animate({
                        scrollTop: t.offset().top - m
                    }, 1000);
                    return false
                }
            }
        })
    }

    function q(d) {
        a(d.target).prev(".panel-heading").find(".more-less").toggleClass("glyphicon-plus glyphicon-minus")
    }
    a(".panel-group").on("hidden.bs.collapse", q);
    a(".panel-group").on("shown.bs.collapse", q);
    var j = document.getElementById("filt-monthly"),
        i = document.getElementById("filt-hourly"),
        p = document.getElementById("switcher"),
        k = document.getElementById("monthly"),
        s = document.getElementById("hourly");
    j.addEventListener("click", function() {
        p.checked = false;
        j.classList.add("toggler--is-active");
        i.classList.remove("toggler--is-active");
        k.classList.remove("none");
        s.classList.add("none")
    });
    i.addEventListener("click", function() {
        p.checked = true;
        i.classList.add("toggler--is-active");
        j.classList.remove("toggler--is-active");
        k.classList.add("none");
        s.classList.remove("none")
    });
    p.addEventListener("click", function() {
        i.classList.toggle("toggler--is-active");
        j.classList.toggle("toggler--is-active");
        k.classList.toggle("none");
        s.classList.toggle("none")
    })
})(jQuery);