(function($){"use strict";UNCODE.onePage=function(isMobile){function init_onepage(){isSectionscroller&&!isMobile&&!$("body").hasClass("uncode-scroll-no-dots")&&!UNCODE.isFullPageSnap&&$("
").prependTo("body"),last=$(".onepage-pagination li").last().find("a").data("index"),$.each($('div[data-parent="true"]'),function(index,val){$(this).attr("data-section",index);if(isMobile)return;if(UNCODE.isUnmodalOpen&&!val.closest("#unmodal-content"))return;var sectionDown=new Waypoint({context:UNCODE.isUnmodalOpen?document.getElementById("unmodal-content"):window,element:val,handler:function(direction){direction=="down"&&changeMenuActive(this.element,index)},offset:function(){return 5+getOffset()}}),sectionUp=new Waypoint({context:UNCODE.isUnmodalOpen?document.getElementById("unmodal-content"):window,element:val,handler:function(direction){direction=="up"&&changeMenuActive(this.element,index)},offset:function(){return-5-getOffset()}});if(isSectionscroller){var label;$(this).attr("data-label")!=undefined?label=$(this).attr("data-label"):label="";var getName=$(this).attr("data-name");getName==undefined&&(getName=index),label!=""&&(isOnePage=!0,label=''+label+"",$("ul.onepage-pagination").append(""+label+""))}}),isSectionscroller&&$.each($("ul.onepage-pagination li"),function(index,val){var $this=$(val),$a=("a",$this);$a.on("click",function(evt){if($(".is-selected",$this).length||UNCODE.scrolling)return!1;$("body").hasClass("uncode-scroll-no-history")&&evt.preventDefault(),Waypoint.refreshAll();var el=$("a",evt.currentTarget);current=lastScrolled=parseInt(el.attr("data-index")),lastScrolled+=1,scrollBody(current)})});var goToSection=parseInt(window.location.hash.replace(/[^\d.]/g,""));isNaN(goToSection)&&window.location.hash!=undefined&&window.location.hash!=""&&(goToSection=String(window.location.hash).replace(/^#/,""),goToSection=Number($('[data-name="'+goToSection+'"]').attr("data-section"))),typeof goToSection=="number"&&!isNaN(goToSection)&&!$("body").hasClass("uncode-no-hash-scroll")&&(current=lastScrolled=goToSection,$(window).on("load",function(){$(".owl-carousel").length?requestTimeout(function(){scrollBody(goToSection)},400):scrollBody(goToSection)}))}function changeMenuActive(section,index){current=lastScrolled=parseInt($(section).attr("data-section"));if(isOnePage){var newSection=$('.onepage-pagination li a[data-index="'+index+'"]');newSection.length&&($("ul.onepage-pagination li a").removeClass("is-selected"),newSection.addClass("is-selected"));var getName=$('[data-section="'+index+'"]').attr("data-name");getName!=undefined&&getName!==""&&$.each($(".menu-container .menu-item > a, .widget_nav_menu .menu-smart .menu-item > a"),function(i,val){var get_href=$(val).attr("href");get_href!=undefined&&get_href.substring(get_href.indexOf("#")+1)==getName&&($(val).closest(".menu-smart").find(".active").removeClass("active"),$(val).parent().addClass("active"))})}}var current=0,last=0,lastScrollTop=0,forceScroll=!1,lastScrolled=0,isSectionscroller=$(".main-onepage").length?!0:!1,isOnePage=!1,getOffset=function(){var calculateOffset=$(".menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container)").length&&$(window).width()>UNCODE.mediaQuery?$(".menu-sticky .menu-container:not(.menu-hide):not(.vmenu-container").outerHeight():0;return calculateOffset};isMobile=SiteParameters.uncode_force_onepage_dots?!1:isMobile,isOnePage&&$(window).on("scroll",function(){var bodyTop=document.documentElement.scrollTop||document.body.scrollTop;if(bodyTop==0){$("ul.onepage-pagination li a").removeClass("is-selected"),$('.onepage-pagination li a[data-index="0"]').addClass("is-selected");var getName=$("[data-section=0]").attr("data-name");getName!=undefined&&getName!==""&&$.each($(".menu-container .menu-item > a"),function(i,val){var get_href=$(val).attr("href");get_href!=undefined&&get_href.substring(get_href.indexOf("#")+1)==getName&&($(val).closest("ul").find(".active").removeClass("active"),$(val).parent().addClass("active"))})}else if(window.innerHeight+bodyTop>=$(".box-container").height()){var lastSection=$('.onepage-pagination li a[data-index="'+last+'"]');lastSection.length&&($("ul.onepage-pagination li a").removeClass("is-selected"),lastSection.addClass("is-selected"))}});var scrollBody=function(index){$("ul.onepage-pagination li a").removeClass("is-selected"),$('.onepage-pagination li a[data-index="'+index+'"]').addClass("is-selected");var getSection=$("[data-section="+index+"]"),scrollTo;if(getSection==undefined)return;var body=$("html, body"),bodyTop=document.documentElement.scrollTop||document.body.scrollTop,delta=bodyTop-($('[data-section="'+index+'"]').length?$('[data-section="'+index+'"]').offset().top:0),getOffset=UNCODE.get_scroll_offset(index);if(typeof getSection.offset()=="undefined")return;scrollTo=getSection.offset().top;if(!($(".menu-desktop-transparent").length&&UNCODE.wwidth>UNCODE.mediaQuery)){var shrink=typeof $(".navbar-brand").data("padding-shrink")!="undefined"?$(".navbar-brand").data("padding-shrink")*2:36;$(".menu-sticky .menu-container:not(.menu-hide)").length&&$(".menu-shrink").length&&(scrollTo+=UNCODE.menuHeight-($(".navbar-brand").data("minheight")+shrink)),$(".menu-sticky .menu-container:not(.menu-hide)").length&&!$(".menu-shrink").length&&$(".body").hasClass("vmenu")?index===0?scrollTo=0:scrollTo-=$(".menu-sticky .menu-container").outerHeight():scrollTo-=getOffset}var scrollSpeed=SiteParameters.constant_scroll=="on"?Math.abs(delta)/parseFloat(SiteParameters.scroll_speed):SiteParameters.scroll_speed;scrollSpeed<1e3&&SiteParameters.constant_scroll=="on"&&(scrollSpeed=1e3),index!=0&&(UNCODE.scrolling=!0),scrollSpeed==0?(body.scrollTop(delta>0?scrollTo-.1:scrollTo),UNCODE.scrolling=!1):body.on("scroll wheel DOMMouseScroll mousewheel touchmove",function(){$(this).stop()}).animate({scrollTop:delta>0?scrollTo-.1:scrollTo},scrollSpeed,"easeInOutCubic",function(){$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"),UNCODE.scrolling=!1;if(scrollTo!=UNCODE.get_scroll_offset(index)&&!($(".menu-desktop-transparent").length&&UNCODE.wwidth>UNCODE.mediaQuery)&&!($(".menu-mobile-transparent").length&&UNCODE.wwidth<=UNCODE.mediaQueryMobile)||$(".menu-hided").length)scrollTo=getSection.offset().top,getOffset=UNCODE.get_scroll_offset(index),scrollTo-=getOffset,body.on("scroll wheel DOMMouseScroll mousewheel touchmove",function(){$(this).stop()}).animate({scrollTop:delta>0?scrollTo-.1:scrollTo},scrollSpeed,"easeInOutCubic",function(){$(this).off("scroll wheel DOMMouseScroll mousewheel touchmove"),UNCODE.scrolling=!1})})};init_onepage()}})(jQuery)