! function(e) { "use strict"; var i = i || {}; i.init = function() { i.$body = e(document.body), i.$window = e(window), i.$header = e("#masthead"), this.scrollTop(), this.activeHeaderMenu(), this.searchToggle(), this.Headersticky(), this.menuBlockRight(), this.mobileMenu(), /*this.pageHeader(),*/ this.widgetOffice(), this.singlePortfolioGallery(), /*this.portfolioFilter(),*/ this.imagesPopUp(), this.productQuantity(), this.singleGallery() }, i.scrollTop = function() { var t = e("#scroll-top"); i.$window.scroll(function() { i.$window.scrollTop() > i.$window.height() ? t.addClass("show-scroll") : t.removeClass("show-scroll") }), t.on("click", function(i) { i.preventDefault(), e("html, body").stop().animate({ scrollTop: 0 }, 800) }) }, i.menuBlockRight = function() { var t = e(".menu-block-right"), a = e(".container").width(), n = (i.$window.width() - a) / 2; i.$window.on("resize", function() { t.css({ width: n, right: -1 * n }) }).trigger("resize") }, i.searchToggle = function() { e("a.toggle-search").on("click", function(i) { i.preventDefault(), e(this).parent().toggleClass("show-search") }) }, i.mobileMenu = function() { function t(e) { e.closest("li").siblings().find("ul").slideUp(), e.closest("li").siblings().removeClass("active"), e.closest("li").siblings().find("li").removeClass("active"), e.closest("li").children("ul").slideToggle(), e.closest("li").toggleClass("active") } var a = e("#primary-mobile-nav"); i.$header.on("click", "#mf-navbar-toggle", function(e) { e.preventDefault(), a.toggleClass("open"), i.$body.toggleClass("open-canvas-panel") }), a.find(".menu .menu-item-has-children > a").prepend(''), a.on("click", ".menu-item-has-children > a, .menu-item-has-children > span", function(i) { i.preventDefault(), t(e(this)) }), a.on("click", ".close-canvas-mobile-panel", function(t) { t.preventDefault(), i.$body.removeClass("open-canvas-panel"), e("#primary-mobile-nav").removeClass("open") }), e("#off-canvas-layer").on("click", function(t) { t.preventDefault(), i.$body.removeClass("open-canvas-panel"), e("#primary-mobile-nav").removeClass("open") }), i.$window.on("resize", function() { i.$window.width() > 1200 && a.hasClass("open") && (a.removeClass("open"), i.$body.removeClass("open-canvas-panel")) }) }, i.Headersticky = function() { if (i.$body.hasClass("header-sticky")) { var t, a, n, o, s, l; i.$window.on("resize", function() { t = i.$header.outerHeight(!0), a = i.$header.find(".site-contact").outerHeight(!0), o = i.$body.hasClass("header-v1") ? a : t, e("#mf-header-minimized").height(o) }).trigger("resize"), i.$window.on("scroll", function() { n = e("#topbar").outerHeight(!0), a = i.$header.find(".site-contact").outerHeight(!0), l = -1 * a, i.$body.hasClass("admin-bar") && (l += 32), s = (i.$body.hasClass("header-v1") || i.$body.hasClass("header-v2")) && i.$window.width() > 1199 ? n + a : n, i.$window.scrollTop() > s ? (i.$header.addClass("minimized"), e("#mf-header-minimized").addClass("minimized"), (i.$body.hasClass("header-v1") || i.$body.hasClass("header-v2")) && i.$window.width() > 1199 && i.$header.css("top", l)) : (i.$header.removeClass("minimized"), e("#mf-header-minimized").removeClass("minimized"), (i.$body.hasClass("header-v1") || i.$body.hasClass("header-v2")) && i.$header.removeAttr("style")) }) } }/*, i.pageHeader = function() { e(".page-header.parallax").find(".featured-image").parallax("50%", .6), e(".mf-service-banner").parallax("50%", .6) }*/, i.widgetOffice = function() { var i = e(".office-location .office-switcher ul li"), t = i.filter(":first"), a = e(".office-location .office-switcher a"), n = e(".office-location .topbar-office"); t.addClass("active"), n.filter(":first").addClass("active"), a.html(t.html()), a.on("click", function(i) { var t = e(this); i.preventDefault(), t.parent().toggleClass("show-office") }), i.on("click", function() { var t = e(this), o = t.attr("data-tab"); t.hasClass("active") || (a.html(t.html()), a.parent().toggleClass("show-office"), i.removeClass("active"), n.removeClass("active"), t.addClass("active"), e("#" + o).addClass("active")) }) }, i.activeHeaderMenu = function() { var t, a, n, o, s, l, r, c = i.$header.find("ul.menu"); c.find("li:last-child").addClass("last-child"), c.append('
  • '); var d, h = e("#mf-active-menu"); s = 0, c.children("li.current-menu-item, li.current-menu-ancestor, li.current-menu-parent").length > 0 && (l = c.children("li.current-menu-item, li.current-menu-ancestor, li.current-menu-parent").outerWidth(), n = c.children("li.current-menu-item, li.current-menu-ancestor, li.current-menu-parent").children("a").outerWidth(), d = (l - n / 2) / 2, n /= 2, h.width(n).css("left", c.children("li.current-menu-item, li.current-menu-ancestor, li.current-menu-parent").position().left + d).data("origLeft", h.position().left).data("origWidth", h.width()), s = h.data("origWidth")), c.children("li").hover(function() { t = e(this), r = t.outerWidth(), o = t.children("a").outerWidth(), d = (r - o / 2) / 2, o /= 2, a = t.position().left + d, h.stop().animate({ left: a, width: o }) }, function() { h.stop().animate({ left: h.data("origLeft"), width: s }) }) }, i.singlePortfolioGallery = function() { e(".single-portfolio .entry-thumbnail.portfolio-gallery").owlCarousel({ items: 1, loop: !0, nav: !1, autoplay: !1, autoplayTimeout: 0, autoplaySpeed: 0, dots: !0, navSpeed: 800, dotsSpeed: 800 }) }, i.singleGallery = function() { e(".format-gallery.owl-carousel").owlCarousel({ loop: !1, items: 1, nav: !1, dots: !0 }) }/*, i.portfolioFilter = function() { var i = e(".mf-list-portfolio"); if (i.length) { var t = { itemSelector: ".project-wrapper", transitionDuration: "0.7s" }; i.imagesLoaded(function() { e(this.elements).isotope(t) }); var a = e(".nav-filter"); a.on("click", "a", function(i) { i.preventDefault(); var t = e(this), n = t.attr("data-filter"); a.find("a").removeClass("active"), e(this).addClass("active"), t.closest(".nav-section").next(".mf-list-portfolio").isotope({ filter: n }) }) } }*/, i.imagesPopUp = function() { var i = e(".mf-gallery-popup"); if (i.length) { var t = i.find("a.photoswipe"), a = []; t.each(function() { var i = e(this), t = i.find("img").outerWidth(), n = i.find("img").outerHeight(); a.push({ src: i.attr("href"), w: t, h: n }) }), i.on("click", "a.photoswipe", function(i) { i.preventDefault(); var n = { index: t.index(e(this)), bgOpacity: .85, showHideOpacity: !0, mainClass: "pswp--minimal-dark", barsSize: { top: 0, bottom: 0 }, captionEl: !1, fullscreenEl: !1, shareEl: !1, tapToClose: !0, tapToToggleControls: !1 }; new PhotoSwipe(document.getElementById("pswp"), window.PhotoSwipeUI_Default, a, n).init() }) } }, i.productQuantity = function() { i.$body.on("click", ".quantity .increase, .quantity .decrease", function(i) { i.preventDefault(); var t = e(this), a = t.siblings(".qty"), n = parseInt(a.val(), 10), o = parseInt(a.attr("min"), 10), s = parseInt(a.attr("max"), 10); o = o || 1, s = s || n + 1, t.hasClass("decrease") && n > o && (a.val(n - 1), a.trigger("change")), t.hasClass("increase") && n < s && (a.val(n + 1), a.trigger("change")) }) }, e(function() { i.init() }) }(jQuery);