(function($){
"use strict";
window.NextGEN_TikTok={
extract_id: function(url){
if(!url) return null;
url=url.trim();
var patterns=[
/tiktok\.com\/@[^\/]+\/video\/(\d+)/i,
/tiktok\.com\/v\/(\d+)/i,
/tiktok\.com\/embed\/v2\/(\d+)/i,
/tiktok\.com\/.*[?&]v=(\d+)/i,
/\/video\/(\d+)/i,
/^(\d{15,25})$/,
];
for (var i=0; i < patterns.length; i++){
var match=url.match(patterns[i]);
if(match&&match[1]){
return match[1];
}}
if(url.match(/vm\.tiktok\.com|tiktok\.com\/t\//i)){
var idMatch=url.match(/(\d{15,25})/);
if(idMatch){
return idMatch[1];
}
return null;
}
return null;
},
create_player: function(videoUrl, containerClass, videoClass){
var container=document.createElement("div");
container.className=containerClass||"ngg-tiktok-container";
var video=document.createElement("video");
video.className=videoClass||"ngg-tiktok-video";
video.controls=true;
video.autoplay=true;
video.playsInline=true;
video.muted=true;
video.loop=true;
video.preload="auto";
video.setAttribute("playsinline", "");
video.setAttribute("webkit-playsinline", "");
video.src=videoUrl;
video.addEventListener("loadedmetadata", function (){
var naturalWidth=video.videoWidth;
var naturalHeight=video.videoHeight;
if(naturalWidth&&naturalHeight){
var container=video.closest('.ngg-tiktok-container');
var displayWidth=naturalWidth;
var displayHeight=naturalHeight;
if(container){
var fancyboxContent=container.closest('#fancybox-content');
var tbWindow=container.closest('#TB_window');
var slImage=container.closest('.sl-image');
var shWrap=container.closest('#shWrap');
if(shWrap){
var wiH=window.innerHeight||0;
var dbH=document.body.clientHeight||0;
var deH=document.documentElement ? document.documentElement.clientHeight:0;
var wHeight;
if(wiH > 0){
wHeight=((wiH - dbH) > 1&&(wiH - dbH) < 30) ? dbH:wiH;
wHeight=((wHeight - deH) > 1&&(wHeight - deH) < 30) ? deH:wHeight;
}else{
wHeight=(deH > 0) ? deH:dbH;
}
if(document.getElementsByTagName("body")[0].className.match(/admin-bar/)
&& document.getElementById('wpadminbar')!==null){
wHeight=wHeight - document.getElementById('wpadminbar').offsetHeight;
}
var shHeight=wHeight - 50;
var deW=document.documentElement ? document.documentElement.clientWidth:0;
var dbW=window.innerWidth||document.body.clientWidth;
var wWidth=(deW > 1) ? deW:dbW;
if(displayHeight > shHeight){
displayWidth=displayWidth * (shHeight / displayHeight);
displayHeight=shHeight;
}
if(displayWidth > (wWidth - 16)){
displayHeight=displayHeight * ((wWidth - 16) / displayWidth);
displayWidth=wWidth - 16;
}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.style.maxWidth="none";
video.style.maxHeight="none";
video.setAttribute("width", displayWidth);
video.setAttribute("height", displayHeight);
}else if(fancyboxContent){
setTimeout(function(){
var contentRect=fancyboxContent.getBoundingClientRect();
if(contentRect.width > 10&&contentRect.height > 10){
var maxW=contentRect.width;
var maxH=contentRect.height;
if(displayWidth > maxW||displayHeight > maxH){
var ratio=displayWidth / displayHeight > maxW / maxH
? displayWidth / maxW
: displayHeight / maxH;
displayWidth=displayWidth / ratio;
displayHeight=displayHeight / ratio;
}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.setAttribute("width", displayWidth);
video.setAttribute("height", displayHeight);
}}, 50);
return;
}else if(tbWindow){
var pageWidth=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;
var pageHeight=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;
var x=pageWidth - 150;
var y=pageHeight - 150;
if(displayWidth > x){
displayHeight=displayHeight * (x / displayWidth);
displayWidth=x;
if(displayHeight > y){
displayWidth=displayWidth * (y / displayHeight);
displayHeight=y;
}}else if(displayHeight > y){
displayWidth=displayWidth * (y / displayHeight);
displayHeight=y;
if(displayWidth > x){
displayHeight=displayHeight * (x / displayWidth);
displayWidth=x;
}}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.setAttribute("width", displayWidth);
video.setAttribute("height", displayHeight);
}else if(slImage){
var widthRatio=0.8;
var heightRatio=0.9;
var windowWidth=window.innerWidth;
var windowHeight=window.innerHeight;
var maxWidth=windowWidth * widthRatio;
var maxHeight=windowHeight * heightRatio;
if(displayWidth > maxWidth||displayHeight > maxHeight){
var ratio=displayWidth / displayHeight > maxWidth / maxHeight
? displayWidth / maxWidth
: displayHeight / maxHeight;
displayWidth /=ratio;
displayHeight /=ratio;
}
video.style.width=displayWidth + "px";
video.style.height=displayHeight + "px";
video.style.maxWidth=maxWidth + "px";
video.style.maxHeight=maxHeight + "px";
}}
}});
video.addEventListener("canplay", function (){
video.play().catch(function (){});
});
container.appendChild(video);
return container;
},
handle_content: function(options){
var self=this;
var playUrl=options.playUrl;
var $targetContainer=$(options.container);
if(!playUrl) return null;
var tiktokContent=null;
var applyDimensions=function (el){
if(options.width){
var w=typeof options.width==="number" ? options.width + "px":options.width;
el.style.width=w;
var inner=el.querySelector("video, iframe, .ngg-tiktok-error-content");
if(inner) inner.style.width="100%";
}
if(options.height){
var h=typeof options.height==="number" ? options.height + "px":options.height;
el.style.height=h;
var inner=el.querySelector("video, iframe, .ngg-tiktok-error-content");
if(inner) inner.style.height="100%";
}};
if(playUrl){
var decodedUrl=playUrl;
try {
decodedUrl=decodeURIComponent(playUrl);
} catch (e){}
tiktokContent=self.create_player(decodedUrl, options.containerClass, options.videoClass);
if(tiktokContent){
applyDimensions(tiktokContent);
var video=tiktokContent.querySelector("video");
if(video){
video.onerror=function (){
$(tiktokContent).remove();
var errorMsg=self.create_error("Video failed to load", options.errorClass);
applyDimensions(errorMsg);
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(errorMsg);
$targetContainer.append(errorMsg);
};}
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(tiktokContent);
$targetContainer.append(tiktokContent);
}}else{
var errorMsg=self.create_error("Video not available", options.errorClass);
applyDimensions(errorMsg);
if(typeof options.onBeforeAppend==="function") options.onBeforeAppend(errorMsg);
$targetContainer.append(errorMsg);
tiktokContent=errorMsg;
}
return tiktokContent;
},
create_error: function(message, containerClass){
var container=document.createElement("div");
container.className=containerClass||"ngg-tiktok-error";
container.innerHTML =
'<div class="ngg-tiktok-error-content">' +
'<span class="ngg-tiktok-error-icon">&#9888;</span>' +
'<span class="ngg-tiktok-error-text">' +
(message||"Video failed to load") +
"</span>" +
"</div>";
return container;
}};})(jQuery);
jQuery(function ($){
var selector=null;
var lightbox=null;
var allowedTags={
a: ["href", "title", "target", "rel"],
b: [],
i: [],
u: [],
em: [],
strong: [],
p: [],
br: [],
span: ["class", "id", "style"],
img: ["src", "alt", "title"],
h1: [],
h2: [],
h3: [],
h4: [],
h5: [],
h6: [],
ul: [],
ol: [],
li: [],
};
var sanitizeHTML=function (str){
var tempDiv=document.createElement("div");
tempDiv.innerHTML=str;
var elements=tempDiv.querySelectorAll("*");
elements.forEach(function (el){
var tagName=el.tagName.toLowerCase();
if(!allowedTags.hasOwnProperty(tagName)){
el.replaceWith(el.innerHTML);
return;
}
var allowedAttributes=allowedTags[tagName];
for (var i=el.attributes.length - 1; i >=0; i--){
var attrName=el.attributes[i].name;
var attrValue=el.attributes[i].value;
if(!allowedAttributes.includes(attrName)){
el.removeAttribute(attrName);
}
if(["href", "src"].includes(attrName) &&
attrValue.startsWith("javascript:")
){
el.removeAttribute(attrName);
}
if(attrName==="title"){
el.setAttribute("title", sanitizeTitle(attrValue));
}}
});
var sanitizedText=tempDiv.innerHTML;
return sanitizedText.replace(/\\/g, "");
};
var sanitizeTitle=function (title){
return title
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;");
};
var sanitizeCaptions=function (){
$(".ngg-simplelightbox").each(function (){
var caption=$(this).attr("title");
if(caption){
var sanitizedCaption=sanitizeHTML(caption);
$(this).attr("title", sanitizedCaption);
}});
};
var handleTikTokContent=function (element, imageContainer){
var playUrl=element.getAttribute("data-tiktok-play-url");
var shareUrl=element.getAttribute("data-tiktok-share-url");
if(!playUrl&&!shareUrl){
imageContainer.classList.remove("sl-tiktok-mode");
return false;
}
imageContainer.classList.add("sl-tiktok-mode");
var existingContainer=imageContainer.querySelector(".ngg-tiktok-container");
if(existingContainer){
existingContainer.remove();
}
var existingError=imageContainer.querySelector(".ngg-tiktok-error");
if(existingError){
existingError.remove();
}
var $img=$(imageContainer).find("img");
NextGEN_TikTok.handle_content({
playUrl: playUrl,
shareUrl: shareUrl,
container: imageContainer,
width: $img.width(),
height: $img.height(),
onBeforeAppend: function (){
$img.hide();
},
});
return true;
};
var cleanupTikTokContent=function (imageContainer){
imageContainer.classList.remove("sl-tiktok-mode");
var tiktokContainer=imageContainer.querySelector(".ngg-tiktok-container");
if(tiktokContainer){
tiktokContainer.remove();
}
var errorContainer=imageContainer.querySelector(".ngg-tiktok-error");
if(errorContainer){
errorContainer.remove();
}};
var getVideoSettings=function(galleryId){
if(!window.ngg_video_gallery_settings){
return {
show_video_controls: true,
show_play_pause_controls: true,
autoplay_videos: false
};}
var settings=window.ngg_video_gallery_settings;
var galleryIdStr=galleryId ? String(galleryId):null;
if(galleryIdStr&&settings['gallery_' + galleryIdStr]){
return settings['gallery_' + galleryIdStr];
}
return settings.default||{
show_video_controls: true,
show_play_pause_controls: true,
autoplay_videos: false
};};
var handleVideoContent=function (element, imageContainer){
const videoContainer=document.querySelector(".sl-wrapper")
var videoUrl=element.getAttribute("data-video-url")||element.getAttribute("href");
if(!videoUrl){
videoContainer.classList.remove("sl-video-mode");
return false;
}
if(!window.NextGEN_Video||!window.NextGEN_Video.detect_platform(videoUrl)){
videoContainer.classList.remove("sl-video-mode");
return false;
}
videoContainer.classList.add("sl-video-mode");
var existingContainer=imageContainer.querySelector(".ngg-video-container");
if(existingContainer){
existingContainer.remove();
}
var existingError=imageContainer.querySelector(".ngg-video-error");
if(existingError){
existingError.remove();
}
var galleryId=null;
var $galleryContainer=$(element).closest('[data-gallery-id]');
if($galleryContainer.length){
galleryId=$galleryContainer.attr('data-gallery-id')||$galleryContainer.data('gallery-id');
}
var videoSettings=getVideoSettings(galleryId);
var $img=$(imageContainer).find("img");
if(window.NextGEN_Video&&window.NextGEN_Video.handle_content){
window.NextGEN_Video.handle_content({
videoUrl: videoUrl,
container: imageContainer,
settings: videoSettings,
containerClass: "ngg-video-container",
videoClass: "ngg-video-player",
errorClass: "ngg-video-error",
onBeforeAppend: function (){
$img.hide();
},
});
}
return true;
};
var cleanupVideoContent=function (imageContainer){
imageContainer.classList.remove("sl-video-mode");
var videoContainer=imageContainer.querySelector(".ngg-video-container");
if(videoContainer){
videoContainer.remove();
}
var errorContainer=imageContainer.querySelector(".ngg-video-error");
if(errorContainer){
errorContainer.remove();
}};
var createLightboxHandlers=function (options){
var handleContent=options.handleContent;
var cleanupContent=options.cleanupContent;
var eventName=options.eventName||"simplelightbox";
return function (elements){
elements.each(function (){
var el=this;
el.addEventListener("shown." + eventName, function (){
setTimeout(function (){
var imageContainer=document.querySelector(".sl-image");
if(imageContainer){
handleContent(el, imageContainer);
}}, 150);
});
el.addEventListener("changed." + eventName, function (){
setTimeout(function (){
var imageContainer=document.querySelector(".sl-image");
if(imageContainer){
cleanupContent(imageContainer);
handleContent(el, imageContainer);
}}, 150);
});
el.addEventListener("close." + eventName, function (){
var imageContainer=document.querySelector(".sl-image");
if(imageContainer){
cleanupContent(imageContainer);
}});
});
};};
var attachTikTokHandlers=createLightboxHandlers({
handleContent: handleTikTokContent,
cleanupContent: cleanupTikTokContent,
});
var attachVideoHandlers=createLightboxHandlers({
handleContent: handleVideoContent,
cleanupContent: cleanupVideoContent,
});
var nextgen_simplebox_options={
history: false,
animationSlide: false,
animationSpeed: 100,
captionSelector: "self",
};
var nextgen_simplelightbox_init=function (){
sanitizeCaptions();
selector=nextgen_lightbox_filter_selector($, $(".ngg-simplelightbox"));
if(selector.length > 0){
lightbox=selector.simpleLightbox(nextgen_simplebox_options);
attachTikTokHandlers(selector);
attachVideoHandlers(selector);
}};
nextgen_simplelightbox_init();
$(window).on("refreshed", function (){
if(lightbox){
lightbox.destroy();
}
sanitizeCaptions();
selector=nextgen_lightbox_filter_selector($, $(".ngg-simplelightbox"));
if(selector.length > 0){
lightbox=selector.simpleLightbox(nextgen_simplebox_options);
attachTikTokHandlers(selector);
attachVideoHandlers(selector);
}});
});
(function($){
"use strict";
$(function(){
$.avia_utilities=$.avia_utilities||{};
if('undefined'==typeof $.avia_utilities.isMobile){
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)&&'ontouchstart' in document.documentElement){
$.avia_utilities.isMobile=true;
}else{
$.avia_utilities.isMobile=false;
}}
avia_hamburger_menu();
$(window).trigger('resize');
});
$.avia_utilities=$.avia_utilities||{};
function avia_hamburger_menu(){
var header=$('#header'),
header_main=$('#main .av-logo-container'),
menu=$('#avia-menu'),
burger_wrap=$('.av-burger-menu-main a'),
htmlEL=$('html').eq(0),
overlay=$('<div class="av-burger-overlay" role="menu" aria-orientation="vertical"></div>'),
overlay_scroll=$('<div class="av-burger-overlay-scroll"></div>').appendTo(overlay),
inner_overlay=$('<div class="av-burger-overlay-inner"></div>').appendTo(overlay_scroll),
bgColor=$('<div class="av-burger-overlay-bg"></div>').appendTo(overlay),
animating=false,
first_level={},
logo_container=$('.av-logo-container .inner-container'),
menu_in_logo_container=logo_container.find('.main_menu'),
cloneFirst=htmlEL.is('.html_av-submenu-display-click.html_av-submenu-clone, .html_av-submenu-display-hover.html_av-submenu-clone'),
menu_generated=false,
cloned_menu_cnt=0;
if(! htmlEL.hasClass('html_av-submenu-hidden') ){
htmlEL.addClass('html_av-submenu-visible');
}
var alternate=$('#avia_alternate_menu');
if(alternate.length > 0){
menu=alternate;
}
var	set_list_container_height=function(){
if($.avia_utilities.isMobile){
overlay_scroll.outerHeight(window.innerHeight);
}},
create_list=function(items , append_to){
if(! items){
return;
}
var list, link, current, subitems, megacolumns, sub_current, sub_current_list, new_li, new_ul;
items.each(function(){
current=$(this);
subitems=current.find(' > .sub-menu > li');
if(subitems.length==0){
subitems=current.find(' > .children > li');
}
megacolumns=current.find('.avia_mega_div > .sub-menu > li.menu-item');
var cur_menu=current.find('>a');
var clone_events=true;
if(cur_menu.length){
if(cur_menu.get(0).hash=='#'||'undefined'==typeof cur_menu.attr('href')||cur_menu.attr('href')=='#'){
if(subitems.length > 0||megacolumns.length > 0){
clone_events=false;
}}
}
link=cur_menu.clone(clone_events).attr('style','');
if('undefined'==typeof cur_menu.attr('href')){
link.attr('href', '#');
}
new_li=$('<li>').append(link);
new_li.attr('role', 'menuitem');
var cls=[];
if('undefined'!=typeof current.attr('class')){
cls=current.attr('class').split(/\s+/);
$.each(cls, function(index, value){
if(( value.indexOf('menu-item')!=0)&&(value.indexOf('page-item') < 0)&&(value.indexOf('page_item')!=0)&&(value.indexOf('dropdown_ul') < 0) ){
new_li.addClass(value);
}
return true;
});
}
if('undefined'!=typeof current.attr('id')&&''!=current.attr('id')){
new_li.addClass(current.attr('id'));
}else{
$.each(cls, function(index, value){
if(value.indexOf('page-item-') >=0){
new_li.addClass(value);
return false;
}});
}
append_to.append(new_li);
if(subitems.length){
new_ul=$('<ul class="sub-menu">').appendTo(new_li);
if(cloneFirst&&(link.get(0).hash!='#'&&link.attr('href')!='#')){
new_li.clone(true).prependTo(new_ul);
}
new_li.addClass('av-width-submenu').find('>a').append('<span class="av-submenu-indicator">');
create_list(subitems , new_ul);
}
else if(megacolumns.length){
new_ul=$('<ul class="sub-menu">').appendTo(new_li);
if(cloneFirst&&(link.get(0).hash!='#'&&link.attr('href')!='#')){
new_li.clone(true).prependTo(new_ul);
}
megacolumns.each(function(iteration){
var megacolumn=$(this),
mega_current=megacolumn.find('> .sub-menu'),
mega_title=megacolumn.find('> .mega_menu_title'),
mega_title_link=mega_title.find('a').attr('href')||"#",
current_megas=mega_current.length > 0 ? mega_current.find('>li'):null,
mega_title_set=false,
mega_link=new_li.find('>a'),
hide_enty='';
if(( current_megas===null)||(current_megas.length==0) ){
if(mega_title_link=='#'){
hide_enty=' style="display: none;"';
}}
if(iteration==0) new_li.addClass('av-width-submenu').find('>a').append('<span class="av-submenu-indicator">');
if(mega_title.length&&mega_title.text()!=""){
mega_title_set=true;
if(iteration > 0){
var check_li=new_li.parents('li').eq(0);
if(check_li.length) new_li=check_li;
new_ul=$('<ul class="sub-menu">').appendTo(new_li);
}
new_li=$('<li' + hide_enty + '>').appendTo(new_ul);
new_ul=$('<ul class="sub-menu">').appendTo(new_li);
$('<a href="'+mega_title_link+'"><span class="avia-bullet"></span><span class="avia-menu-text">' +mega_title.text()+ '</span></a>').insertBefore(new_ul);
mega_link=new_li.find('>a');
if(cloneFirst&&(mega_current.length > 0)&&(mega_link.length&&mega_link.get(0).hash!='#'&&mega_link.attr('href')!='#')){
new_li.clone(true).addClass('av-cloned-title').prependTo(new_ul);
}}
if(mega_title_set&&(mega_current.length > 0) ){
new_li.addClass('av-width-submenu').find('>a').append('<span class="av-submenu-indicator">');
}
create_list(current_megas , new_ul);
});
}});
burger_wrap.trigger('avia_burger_list_created');
return list;
};
var burger_ul, burger;
$('body').on('mousewheel DOMMouseScroll touchmove', '.av-burger-overlay-scroll', function (e){
var height=this.offsetHeight,
scrollHeight=this.scrollHeight,
direction=e.originalEvent.wheelDelta;
if(scrollHeight!=this.clientHeight){
if(( this.scrollTop >=(scrollHeight - height)&&direction < 0)||(this.scrollTop <=0&&direction > 0)){
e.preventDefault();
}}else{
e.preventDefault();
}});
$(document).on('mousewheel DOMMouseScroll touchmove', '.av-burger-overlay-bg, .av-burger-overlay-active .av-burger-menu-main', function (e){
e.preventDefault();
});
var touchPos={};
$(document).on('touchstart', '.av-burger-overlay-scroll', function(e){
touchPos.Y=e.originalEvent.touches[0].clientY;
});
$(document).on('touchend', '.av-burger-overlay-scroll', function(e){
touchPos={};});
$(document).on('touchmove', '.av-burger-overlay-scroll', function (e){
if(!touchPos.Y){
touchPos.Y=e.originalEvent.touches[0].clientY;
}
var	differenceY=e.originalEvent.touches[0].clientY - touchPos.Y,
element=this,
top=element.scrollTop,
totalScroll=element.scrollHeight,
currentScroll=top + element.offsetHeight,
direction=differenceY > 0 ? "up":"down";
$('body').get(0).scrollTop=touchPos.body;
if(top <=0){
if(direction=="up"){
e.preventDefault();
}}
else if(currentScroll >=totalScroll){
if(direction=="down"){
e.preventDefault();
}}
});
$(window).on('debouncedresize', function (e){
var close=true;
if($.avia_utilities.isMobile&&htmlEL.hasClass('av-mobile-menu-switch-portrait')&&htmlEL.hasClass('html_text_menu_active') ){
var height=$(window).height();
var width=$(window).width();
if(width <=height){
htmlEL.removeClass('html_burger_menu');
}else{
var switch_width=htmlEL.hasClass('html_mobile_menu_phone') ? 768:990;
if(height < switch_width){
htmlEL.addClass('html_burger_menu');
close=false;
}else{
htmlEL.removeClass('html_burger_menu');
}}
}
if(close&&burger&&burger.length){
if(! burger_wrap.is(':visible')){
burger.filter(".is-active").parents('a').eq(0).trigger('click');
}}
set_list_container_height();
});
$('.html_av-overlay-side').on('click', '.av-burger-overlay-bg', function (e){
e.preventDefault();
burger.parents('a').eq(0).trigger('click');
});
$(window).on('avia_smooth_scroll_start', function(){
if(burger&&burger.length){
burger.filter(".is-active").parents('a').eq(0).trigger('click');
}});
$('.html_av-submenu-display-hover').on('mouseenter', '.av-width-submenu', function (e){
$(this).children("ul.sub-menu").slideDown('fast');
});
$('.html_av-submenu-display-hover').on('mouseleave', '.av-width-submenu', function (e){
$(this).children("ul.sub-menu").slideUp('fast');
});
$('.html_av-submenu-display-hover').on('click', '.av-width-submenu > a', function (e){
e.preventDefault();
e.stopImmediatePropagation();
});
$('.html_av-submenu-display-hover').on('touchstart', '.av-width-submenu > a', function (e){
var menu=$(this);
toggle_submenu(menu, e);
});
$('.html_av-submenu-display-click').on('click', '.av-width-submenu > a', function (e){
var menu=$(this);
toggle_submenu(menu, e);
});
$('.html_av-submenu-display-click, .html_av-submenu-visible').on('click', '.av-burger-overlay a', function (e){
var loc=window.location.href.match(/(^[^#]*)/)[0];
var cur=$(this).attr('href').match(/(^[^#]*)/)[0];
if(cur==loc){
e.preventDefault();
e.stopImmediatePropagation();
burger.parents('a').eq(0).trigger('click');
return false;
}
return true;
});
function toggle_submenu(menu, e){
e.preventDefault();
e.stopImmediatePropagation();
var parent=menu.parents('li').eq(0);
parent.toggleClass('av-show-submenu');
if(parent.is('.av-show-submenu')){
parent.children("ul.sub-menu").slideDown('fast');
}else{
parent.children("ul.sub-menu").slideUp('fast');
}};
(function normalize_layout(){
if(menu_in_logo_container.length){
return;
}
var menu2=$('#header .main_menu').clone(true),
ul=menu2.find('ul.av-main-nav'),
id=ul.attr('id');
if('string'==typeof id&&''!=id.trim()){
ul.attr('id', id + '-' + cloned_menu_cnt++);
}
menu2.find('.menu-item:not(.menu-item-avia-special)').remove();
menu2.insertAfter(logo_container.find('.logo').first());
var social=$('#header .social_bookmarks').clone(true);
if(! social.length){
social=$('.av-logo-container .social_bookmarks').clone(true);
}
if(social.length){
menu2.find('.avia-menu').addClass('av_menu_icon_beside');
menu2.append(social);
}
burger_wrap=$('.av-burger-menu-main a');
}());
burger_wrap.on('click', function(e){
if(animating){
return;
}
burger=$(this).find('.av-hamburger'),
animating=true;
if(!menu_generated){
menu_generated=true;
burger.addClass("av-inserted-main-menu");
burger_ul=$('<ul>').attr({id:'av-burger-menu-ul', class:'', 'aria-haspopup': 'true', 'aria-controls': 'menu2'});
var first_level_items=menu.find('> li:not(.menu-item-avia-special)');
var	list=create_list(first_level_items , burger_ul);
burger_ul.find('.noMobile').remove();
burger_ul.appendTo(inner_overlay);
first_level=inner_overlay.find('#av-burger-menu-ul > li');
if($.fn.avia_smoothscroll){
$('a[href*="#"]', overlay).avia_smoothscroll(overlay);
}}
if(burger.is(".is-active")){
burger.removeClass("is-active");
htmlEL.removeClass("av-burger-overlay-active-delayed");
overlay.animate({opacity:0}, function(){
overlay.css({display:'none'});
htmlEL.removeClass("av-burger-overlay-active");
animating=false;
});
}else{
set_list_container_height();
var offsetTop=header_main.length ? header_main.outerHeight() + header_main.position().top:header.outerHeight() + header.position().top;
overlay.appendTo($(e.target).parents('.avia-menu'));
burger_ul.css({padding:(offsetTop) + "px 0px"});
first_level.removeClass('av-active-burger-items');
burger.addClass("is-active");
htmlEL.addClass("av-burger-overlay-active");
overlay.css({display:'block'}).animate({opacity:1}, function(){
animating=false;
});
setTimeout(function(){
htmlEL.addClass("av-burger-overlay-active-delayed");
}, 100);
first_level.each(function(i){
var _self=$(this);
setTimeout(function(){
_self.addClass('av-active-burger-items');
}, (i + 1) * 125);
});
}
e.preventDefault();
});
}})(jQuery);
(function($){
"use strict";
$.avia_utilities=$.avia_utilities||{};
$(function(){
if($.fn.avia_parallax){
$('.av-parallax,.av-parallax-object').avia_parallax();
}});
var AviaObjectParallaxElement=function(options, element){
if(!(this.transform||this.transform3d) ){
return;
}
this.options=$.extend({}, options);
this.win=$(window);
this.body=$('body');
this.isMobile=$.avia_utilities.isMobile,
this.winHeight=this.win.height();
this.winWidth=this.win.width();
this.el=$(element).addClass('active-parallax');
this.objectType=this.el.hasClass('av-parallax-object') ? 'object':'background-image';
this.elInner=this.el;
this.elBackgroundParent=this.el.parent();
this.elParallax=this.el.data('parallax')||{};
this.direction='';
this.speed=0.5;
this.elProperty={};
this.ticking=false,
this.isTransformed=false;
if($.avia_utilities.supported.transition===undefined){
$.avia_utilities.supported.transition=$.avia_utilities.supports('transition');
}
this._init(options);
};
AviaObjectParallaxElement.prototype =
{
mediaQueries: {
'av-mini-':		'(max-width: 479px)',
'av-small-':	'(min-width: 480px) and (max-width: 767px)',
'av-medium-':	'(min-width: 768px) and (max-width: 989px)',
'av-desktop-':	'(min-width: 990px)'
},
transform:			document.documentElement.className.indexOf('avia_transform')!==-1,
transform3d:		document.documentElement.className.indexOf('avia_transform3d')!==-1,
mobileNoAnimation:	$('body').hasClass('avia-mobile-no-animations'),
defaultSpeed:		0.5,
defaultDirections:	[ 'bottom_top', 'left_right', 'right_left', 'no_parallax' ],
transformCSSProps:	[ 'transform', '-webkit-transform', '-moz-transform', '-ms-transform', '-o-transform' ],
matrixDef:			[ 1, 0, 0, 1, 0, 0 ],
matrix3dDef:		[ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ],
_init: function(){
var _self=this;
if(typeof this.el.data('parallax-selector')!='undefined'&&this.el.data('parallax-selector')!==''){
this.elInner=this.el.find(this.el.data('parallax-selector') );
if(this.elInner.length==0){
this.elInner=this.el;
}}
if('background-image'==this.objectType){
if(this.isMobile&&this.mobileNoAnimation){
return;
}
this.elParallax.parallax='bottom_top';
this.elParallax.parallax_speed=parseFloat(this.el.data('avia-parallax-ratio') )||0.5;
}
setTimeout(function(){
_self._fetchProperties();
}, 30);
this.win.on('debouncedresize av-height-change', _self._fetchProperties.bind(_self) );
this.body.on('av_resize_finished', _self._fetchProperties.bind(_self) );
setTimeout(function(){
_self.win.on('scroll', _self._onScroll.bind(_self) );
}, 100);
},
_setParallaxProps: function(){
if('background-image'==this.objectType){
this.direction=this.elParallax.parallax;
this.speed=this.elParallax.parallax_speed;
return;
}
var all_direction=this.elParallax.parallax||'',
all_speed=this.elParallax.parallax_speed||'',
resp_direction='',
resp_speed='',
media='all';
if(this.defaultDirections.indexOf(all_direction) < 0){
all_direction='no_parallax';
}
if(typeof window.matchMedia=='function'){
$.each(this.mediaQueries, function(key, query){
var mql=window.matchMedia(query);
if(mql.matches){
media=key;
return false;
}});
}
if('all'==media){
this.direction=all_direction;
this.speed=''==all_speed ? this.defaultSpeed:parseFloat(all_speed) / 100.0;
return;
}
resp_direction=this.elParallax[ media + 'parallax' ]||'';
resp_speed=this.elParallax[ media + 'parallax_speed' ]||'';
if('inherit'==resp_direction){
resp_direction=all_direction;
resp_speed=all_speed;
}
if(this.defaultDirections.indexOf(resp_direction) < 0){
resp_direction='no_parallax';
}
this.direction=resp_direction;
this.speed=''==resp_speed ? this.defaultSpeed:parseFloat(resp_speed) / 100.0;
},
_getTranslateObject: function(element){
var translate={
type:	'',
matrix: [],
x:		0,
y:		0,
z:		0
};
$.each(this.transformCSSProps, function(i, prop){
var found=element.css(prop);
if('string'!=typeof found||'none'==found){
return;
}
if(found.indexOf('matrix') >=0){
var matrixValues=found.match(/matrix.*\((.+)\)/)[1].split(', ');
if(found.indexOf('matrix3d') >=0){
translate.type='3d';
translate.matrix=matrixValues;
translate.x=matrixValues[12];
translate.y=matrixValues[13];
translate.z=matrixValues[14];
}else{
translate.type='2d';
translate.matrix=matrixValues;
translate.x=matrixValues[4];
translate.y=matrixValues[5];
}
return false;
}else{
translate.type='';
var matchX=found.match(/translateX\((-?\d+\.?\d*px)\)/);
if(matchX){
translate.x=parseInt(matchX[1], 10);
}
var matchY=found.match(/translateY\((-?\d+\.?\d*px)\)/);
if(matchY){
translate.y=parseInt(matchY[1], 10);
}}
});
return translate;
},
_getTranslateMatrix: function(translateObj, changes){
var matrix='';
$.each(changes, function(key, value){
translateObj[key]=value;
});
if(this.transform3d){
var matrix3d=this.matrix3dDef.slice(0);
switch(translateObj.type){
case '2d':
matrix3d[0]=translateObj.matrix[0];
matrix3d[1]=translateObj.matrix[1];
matrix3d[4]=translateObj.matrix[2];
matrix3d[5]=translateObj.matrix[3];
matrix3d[12]=translateObj.x;
matrix3d[13]=translateObj.y;
break;
case '3d':
matrix3d=translateObj.matrix.slice(0);
matrix3d[12]=translateObj.x;
matrix3d[13]=translateObj.y;
matrix3d[14]=translateObj.z;
break;
default:
matrix3d[12]=translateObj.x;
matrix3d[13]=translateObj.y;
break;
}
matrix='matrix3d(' + matrix3d.join(', ') + ')';
}
else if(this.transform){
var matrix2d=this.matrixDef.slice(0);
switch(translateObj.type){
case '2d':
matrix2d=translateObj.matrix.slice(0);
matrix2d[4]=translateObj.x;
matrix2d[5]=translateObj.y;
break;
case '3d':
matrix2d[0]=translateObj.matrix[0];
matrix2d[1]=translateObj.matrix[1];
matrix2d[2]=translateObj.matrix[4];
matrix2d[3]=translateObj.matrix[5];
matrix2d[4]=translateObj.x;
matrix2d[5]=translateObj.y;
break;
default:
matrix2d[4]=translateObj.x;
matrix2d[5]=translateObj.y;
break;
}
matrix='matrix(' + matrix2d.join(', ') + ')';
}
return matrix;
},
_fetchProperties: function(){
this._setParallaxProps();
this.el.css($.avia_utilities.supported.transition + 'transform', '');
this.winHeight=this.win.height();
this.winWidth=this.win.width();
if('background-image'==this.objectType){
this.elProperty.top=this.elBackgroundParent.offset().top;
this.elProperty.height=this.elBackgroundParent.outerHeight();
this.el.height(Math.ceil(( this.winHeight * Math.abs(this.speed) ) + this.elProperty.height) );
}else{
this.elProperty.top=this.elInner.offset().top;
this.elProperty.left=this.elInner.offset().left;
this.elProperty.height=this.elInner.outerHeight();
this.elProperty.width=this.elInner.outerWidth();
this.elProperty.bottom=this.elProperty.top + this.elProperty.height;
this.elProperty.right=this.elProperty.left + this.elProperty.width;
this.elProperty.distanceLeft=this.elProperty.right;
this.elProperty.distanceRight=this.winWidth - this.elProperty.left;
}
this.elProperty.translateObj=this._getTranslateObject(this.el);
this._parallaxScroll();
},
_onScroll: function(e){
var _self=this;
if(! _self.ticking){
_self.ticking=true;
window.requestAnimationFrame(_self._parallaxRequest.bind(_self) );
}},
_inViewport: function(elTop, elRight, elBottom, elLeft, winTop, winBottom, winLeft, winRight){
return !(elTop > winBottom + 10||elBottom < winTop - 10||elLeft > winRight + 10||elRight < winLeft - 10);
},
_parallaxRequest: function(e){
var _self=this;
setTimeout(_self._parallaxScroll.bind(_self), 0);
},
_parallaxScroll: function(e){
if(( 'no_parallax'==this.direction||''==this.direction)&&! this.isTransformed){
this.ticking=false;
return;
}
var winTop=this.win.scrollTop(),
winLeft=this.win.scrollLeft(),
winRight=winLeft + this.winWidth,
winBottom=winTop + this.winHeight,
scrollPos=0,
matrix='';
if('background-image'==this.objectType){
if(this.elProperty.top < winBottom&&winTop <=this.elProperty.top + this.elProperty.height){
scrollPos=Math.ceil(( winBottom - this.elProperty.top) * this.speed);
matrix=this._getTranslateMatrix(this.elProperty.translateObj, { y: scrollPos });
this.el.css($.avia_utilities.supported.transition + 'transform', matrix);
}
this.ticking=false;
return;
}
if(( 'no_parallax'==this.direction||''==this.direction) ){
matrix=this._getTranslateMatrix(this.elProperty.translateObj, { x: 0, y: 0  });
this.el.css($.avia_utilities.supported.transition + 'transform', matrix);
this.ticking=false;
this.isTransformed=false;
return;
}
var scroll_px_toTop=Math.ceil(this.elProperty.top - winTop),
scroll_px_el=Math.ceil(winBottom - this.elProperty.top),
scrolled_pc_toTop=0,
reduceDistanceX=0,
transform={ x: 0, y: 0 };
if(this.elProperty.top < this.winHeight){
reduceDistanceX=Math.ceil(this.winHeight - this.elProperty.top);
}
if(this.elProperty.top > winBottom){
scrolled_pc_toTop=0;
scroll_px_el=0;
}else{
scrolled_pc_toTop=1 -(scroll_px_toTop + reduceDistanceX) / this.winHeight;
}
switch(this.direction){
case 'bottom_top':
scrollPos=Math.ceil(( scroll_px_el - reduceDistanceX) * this.speed);
transform.y=-scrollPos;
matrix=this._getTranslateMatrix(this.elProperty.translateObj, { y: -scrollPos });
break;
case 'left_right':
scrollPos=Math.ceil(this.elProperty.distanceRight * scrolled_pc_toTop * this.speed);
transform.x=scrollPos;
matrix=this._getTranslateMatrix(this.elProperty.translateObj, { x: scrollPos });
break;
case 'right_left':
scrollPos=Math.ceil(this.elProperty.distanceLeft * scrolled_pc_toTop * this.speed);
transform.x=-scrollPos;
matrix=this._getTranslateMatrix(this.elProperty.translateObj, { x: -scrollPos });
break;
default:
break;
}
var elInViewport=this._inViewport(this.elProperty.top, this.elProperty.right, this.elProperty.bottom, this.elProperty.left, winTop, winBottom, winLeft, winRight),
transformedInViewport=this._inViewport(this.elProperty.top + transform.y, this.elProperty.right + transform.x, this.elProperty.bottom + transform.y, this.elProperty.left + transform.x, winTop, winBottom, winLeft, winRight);
if(elInViewport||transformedInViewport){
this.el.css($.avia_utilities.supported.transition + 'transform', matrix);
}
this.ticking=false;
this.isTransformed=true;
}};
$.fn.avia_parallax=function(options){
return this.each(function(){
var obj=$(this);
var self=obj.data('aviaParallax');
if(! self){
self=obj.data('aviaParallax', new AviaObjectParallaxElement(options, this) );
}});
};})(jQuery);