function collapse_init(){
jQuery('.force_content_collapse').each(function(index){
jQuery(this).css('display', 'none');
});
jQuery('.collapseomatic:not(.colomat-close)').each(function(index){
var thisid=jQuery(this).attr('id');
jQuery('#target-'+thisid).css('display', 'none');
});
jQuery('.collapseomatic.colomat-close').each(function(index){
var thisid=jQuery(this).attr('id');
if(jQuery("#swap-"+thisid).length > 0){
swapTitle(this, "#swap-"+thisid);
}
if(jQuery("#swapexcerpt-"+thisid).length > 0){
swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
}
jQuery('[id^=extra][id$='+thisid+']').each(function(index){
if(jQuery(this).data('swaptitle')){
old_swap_title=jQuery(this).data('swaptitle');
old_title=jQuery(this).html();
jQuery(this).html(old_swap_title);
jQuery(this).data('swaptitle', old_title);
}});
});
}
function swapTitle(origObj, swapObj){
if(jQuery(origObj).prop("tagName")=='IMG'){
var origsrc=jQuery(origObj).prop('src');
var swapsrc=jQuery(swapObj).prop('src');
jQuery(origObj).prop('src',swapsrc);
jQuery(swapObj).prop('src',origsrc);
}else{
var orightml=jQuery(origObj).html();
var swaphtml=jQuery(swapObj).html();
jQuery(origObj).html(swaphtml);
jQuery(swapObj).html(orightml);
if(swaphtml.indexOf("<cufon")!=-1){
var trigelem=jQuery(this).get(0).tagName;
Cufon.replace(trigelem);
}}
}
function toggleState (obj, id, maptastic, trig_id){
if(maptastic&&jQuery('[id^=target][id$='+id+']').hasClass('maptastic')){
jQuery('[id^=target][id$='+id+']').removeClass('maptastic');
}
com_effect=com_options.colomatslideEffect;
com_duration=com_options.colomatduration;
if(obj.attr('data-animation_effect')){
com_effect=obj.attr('data-animation_effect');
}
if(obj.attr('data-duration')){
com_duration=obj.attr('data-duration');
}
if(isFinite(com_duration)){
com_duration=parseFloat(com_duration);
}
if(com_effect=='slideToggle'){
jQuery('#target-'+id).slideToggle(com_duration, function(){
if(jQuery(this).hasClass('colomat-inline')&&jQuery(this).is(':visible')){
jQuery(this).css('display', 'inline');
}
if(trig_id&&jQuery('#'+trig_id).is('.find-me.colomat-close')){
findme=jQuery('#'+trig_id).attr('data-findme');
target_offset=jQuery('#'+trig_id).offset();
if(findme=='auto'||findme=='target'){
target_offset=jQuery('#target-'+trig_id).offset();
}
if(findme=='trigger'){
target_offset=jQuery('#'+trig_id).offset();
}
jQuery('html, body').animate({scrollTop:target_offset.top}, 500);
}});
}
else if(com_effect=='slideFade'){
jQuery('#target-'+id).animate({
height: "toggle",
opacity: "toggle"
}, com_duration, function (){
if(jQuery(this).hasClass('colomat-inline')&&jQuery(this).is(':visible')){
jQuery(this).css('display', 'inline');
}
if(trig_id&&jQuery('#'+trig_id).is('.find-me.colomat-close')){
findme=jQuery('#'+trig_id).attr('data-findme');
target_offset=jQuery('#'+trig_id).offset();
if(findme=='auto'||findme=='target'){
target_offset=jQuery('#target-'+trig_id).offset();
}
if(findme=='trigger'){
target_offset=jQuery('#'+trig_id).offset();
}
jQuery('html, body').animate({scrollTop:target_offset.top}, 500);
}});
}
if(jQuery('#'+id).hasClass('colomat-close')){
jQuery('.google-maps-builder').each(function(index){
map=jQuery(".google-maps-builder")[index];
google.maps.event.trigger(map, 'resize');
});
}
if(typeof colomat_callback!='undefined'){
colomat_callback();
}}
function closeOtherGroups(rel){
jQuery('.collapseomatic[rel!="' + rel +'"]').each(function(index){
if(jQuery(this).hasClass('colomat-expand-only')&&jQuery(this).hasClass('colomat-close')){
return;
}
if(jQuery(this).hasClass('colomat-close')&&jQuery(this).attr('rel')!==undefined){
jQuery(this).removeClass('colomat-close');
var id=jQuery(this).attr('id');
jQuery('#parent-'+id).removeClass('colomat-parent-highlight');
if(jQuery("#swap-"+id).length > 0){
swapTitle(this, "#swap-"+id);
}
if(jQuery("#swapexcerpt-"+id).length > 0){
swapTitle("#exerpt-"+id, "#swapexcerpt-"+id);
}
jQuery('[id^=extra][id$='+id+']').each(function(index){
if(jQuery(this).data('swaptitle')){
old_swap_title=jQuery(this).data('swaptitle');
old_title=jQuery(this).html();
jQuery(this).html(old_swap_title);
jQuery(this).data('swaptitle', old_title);
}});
toggleState (jQuery(this), id, false, false);
var ancestors=jQuery('.collapseomatic', '#target-'+id);
ancestors.each(function(index){
jQuery(this).removeClass('colomat-close');
var thisid=jQuery(this).attr('id');
jQuery('#target-'+thisid).css('display', 'none');
})
}});
}
function closeOtherRelMembers(rel, id){
jQuery('.collapseomatic[rel="' + rel +'"]').each(function(index){
closeOtherMembers(this, id);
});
}
function closeOtherTogMembers(togname, id){
jQuery('.collapseomatic[data-togglegroup="' + togname +'"]').each(function(index){
closeOtherMembers(this, id);
});
}
function closeOtherMembers(obj, id){
if(jQuery(obj).hasClass('colomat-expand-only')&&jQuery(obj).hasClass('colomat-close')){
return;
}
if(jQuery(obj).attr('id')!=id&&jQuery(obj).hasClass('colomat-close')){
jQuery(obj).removeClass('colomat-close');
var thisid=jQuery(obj).attr('id');
jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');
if(jQuery("#swap-"+thisid).length > 0){
swapTitle(obj, "#swap-"+thisid);
}
if(jQuery("#swapexcerpt-"+thisid).length > 0){
swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
}
jQuery('[id^=extra][id$='+thisid+']').each(function(index){
if(jQuery(this).data('swaptitle')){
old_swap_title=jQuery(this).data('swaptitle');
old_title=jQuery(this).html();
jQuery(this).html(old_swap_title);
jQuery(this).data('swaptitle', old_title);
}});
if(!jQuery(obj).hasClass('colomat-close')&&jQuery(obj).hasClass('snap-shut')){
jQuery('#target-'+thisid).hide();
}else{
toggleState (jQuery(obj), thisid, false, false);
}
var ancestors=jQuery('.collapseomatic', '#target-'+id);
ancestors.each(function(index){
if(jQuery(this).hasClass('colomat-expand-only')&&jQuery(this).hasClass('colomat-close')){
return;
}
var pre_id=id.split('-');
if(pre_id[0].indexOf('extra')!='-1'){
pre=pre_id.splice(0, 1);
id=pre_id.join('-');
if(jQuery(this).hasClass('scroll-to-trigger')){
var target_offset=jQuery('#'+id).offset();
offset_top=target_offset.top;
}
if(jQuery('#'+id).hasClass('scroll-to-trigger')){
offset_top=jQuery('#scrollonclose-'+id).attr('name');
if(offset_top=='auto'){
var target_offset=jQuery('#'+id).offset();
offset_top=target_offset.top;
}}
jQuery('#'+id).toggleClass('colomat-close');
jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
}
if(jQuery(this).attr('id').indexOf('bot-')=='-1'){
jQuery(this).removeClass('colomat-close');
var thisid=jQuery(this).attr('id');
if(jQuery("#swap-"+thisid).length > 0){
swapTitle(this, "#swap-"+thisid);
}
if(jQuery("#swapexcerpt-"+thisid).length > 0){
swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
}
jQuery('[id^=extra][id$='+thisid+']').each(function(index){
if(jQuery(this).data('swaptitle')){
old_swap_title=jQuery(this).data('swaptitle');
old_title=jQuery(this).html();
jQuery(this).html(old_swap_title);
jQuery(this).data('swaptitle', old_title);
}});
jQuery('#target-'+thisid).css('display', 'none');
}})
}}
function colomat_expandall(loop_items){
if(!loop_items){
loop_items=jQuery('.collapseomatic:not(.colomat-close)');
}
loop_items.each(function(index){
jQuery(this).addClass('colomat-close');
var thisid=jQuery(this).attr('id');
jQuery('#parent-'+thisid).addClass('colomat-parent-highlight');
if(jQuery("#swap-"+thisid).length > 0){
swapTitle(this, "#swap-"+thisid);
}
if(jQuery("#swapexcerpt-"+thisid).length > 0){
swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
}
jQuery('[id^=extra][id$='+thisid+']').each(function(index){
if(jQuery(this).data('swaptitle')){
old_swap_title=jQuery(this).data('swaptitle');
old_title=jQuery(this).html();
jQuery(this).html(old_swap_title);
jQuery(this).data('swaptitle', old_title);
}});
toggleState(jQuery(this), thisid, true, false);
});
}
function colomat_collapseall(loop_items){
if(!loop_items){
loop_items=jQuery('.collapseomatic.colomat-close');
}
loop_items.each(function(index){
if(jQuery(this).hasClass('colomat-expand-only')&&jQuery(this).hasClass('colomat-close')){
return;
}
jQuery(this).removeClass('colomat-close');
var thisid=jQuery(this).attr('id');
jQuery('#parent-'+thisid).removeClass('colomat-parent-highlight');
if(jQuery("#swap-"+thisid).length > 0){
swapTitle(this, "#swap-"+thisid);
}
if(jQuery("#swapexcerpt-"+thisid).length > 0){
swapTitle("#excerpt-"+thisid, "#swapexcerpt-"+thisid);
}
jQuery('[id^=extra][id$='+thisid+']').each(function(index){
if(jQuery(this).data('swaptitle')){
old_swap_title=jQuery(this).data('swaptitle');
old_title=jQuery(this).html();
jQuery(this).html(old_swap_title);
jQuery(this).data('swaptitle', old_title);
}});
toggleState(jQuery(this), thisid, false, false);
});
}
jQuery(document).ready(function(){
com_binding='click';
if(com_options.colomattouchstart){
com_binding='click touchstart';
}
if(com_options.colomatpauseInit){
init_pause=setTimeout(collapse_init, com_options.colomatpauseInit);
}else{
collapse_init();
}
jQuery(document.body).on('post-load', function (){
collapse_init();
});
jQuery('.content_collapse_wrapper').each(function(index){
jQuery(this).css('display', 'inline');
});
jQuery(document).on({
mouseenter: function(){
jQuery(this).addClass('colomat-hover');
},
mouseleave: function(){
jQuery(this).removeClass('colomat-hover');
},
focusin: function(){
jQuery(this).addClass('colomat-hover');
},
focusout: function(){
jQuery(this).removeClass('colomat-hover');
}}, '.collapseomatic');
jQuery(document).on('keypress','.collapseomatic', function(event){
if(event.which==13){
event.currentTarget.click();
};});
jQuery(document.body).on(com_binding, '.collapseomatic', function(event){
var offset_top;
if(jQuery(this).hasClass('colomat-expand-only')&&jQuery(this).hasClass('colomat-close')){
return;
}
if(jQuery(this).attr('rel')&&jQuery(this).attr('rel').toString().indexOf('-highlander')!='-1'&&jQuery(this).hasClass('must-be-one')&&jQuery(this).hasClass('colomat-close')){
return;
}
if(jQuery(this).data('togglegroup')&&jQuery(this).data('togglegroup').toString().indexOf('-highlander')!='-1'&&jQuery(this).hasClass('must-be-one')&&jQuery(this).hasClass('colomat-close')){
return;
}
var id=jQuery(this).attr('id');
if(jQuery(this).hasClass('colomat-close')&&jQuery(this).hasClass('scroll-to-trigger')){
offset_top=jQuery('#scrollonclose-'+id).attr('name');
if(offset_top=='auto'){
var target_offset=jQuery('#'+id).offset();
offset_top=target_offset.top;
}}
var id_arr=id.split('-');
if(id_arr[0].indexOf('extra')!='-1'){
pre=id_arr.splice(0, 1);
id=id_arr.join('-');
if(jQuery(this).hasClass('scroll-to-trigger')){
var target_offset=jQuery('#'+id).offset();
offset_top=target_offset.top;
}
if(jQuery('#'+id).hasClass('scroll-to-trigger')){
offset_top=jQuery('#scrollonclose-'+id).attr('name');
if(offset_top=='auto'){
var target_offset=jQuery('#'+id).offset();
offset_top=target_offset.top;
}}
jQuery('#'+id).toggleClass('colomat-close');
jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
}
else if(id.indexOf('bot-')!='-1'){
id=id.substr(4);
jQuery('#'+id).toggleClass('colomat-close');
if(jQuery(this).hasClass('scroll-to-trigger')){
var target_offset=jQuery('#'+id).offset();
offset_top=target_offset.top;
}
if(jQuery('#'+id).hasClass('scroll-to-trigger')){
offset_top=jQuery('#scrollonclose-'+id).attr('name');
if(offset_top=='auto'){
var target_offset=jQuery('#'+id).offset();
offset_top=target_offset.top;
}}
}else{
jQuery(this).toggleClass('colomat-close');
jQuery('[id^=extra][id$='+id+']').toggleClass('colomat-close');
}
if(jQuery("#swap-"+id).length > 0){
swapTitle(jQuery('#'+id), "#swap-"+id);
}
if(jQuery("#swapexcerpt-"+id).length > 0){
swapTitle("#excerpt-"+id, "#swapexcerpt-"+id);
}
jQuery('[id^=extra][id$='+id+']').each(function(index){
if(jQuery(this).data('swaptitle')){
old_swap_title=jQuery(this).data('swaptitle');
old_title=jQuery(this).html();
jQuery(this).html(old_swap_title);
jQuery(this).data('swaptitle', old_title);
}});
jQuery(this).addClass('colomat-visited');
var parentID='parent-'+id;
jQuery('#' + parentID).toggleClass('colomat-parent-highlight');
if(!jQuery(this).hasClass('colomat-close')&&jQuery(this).hasClass('snap-shut')){
jQuery('#target-'+id).hide();
}else{
toggleState (jQuery(this), id, true, id);
}
if(jQuery(this).attr('rel')!==undefined){
var rel=jQuery(this).attr('rel').toString();
if(rel.indexOf('-highlander')!='-1'){
closeOtherRelMembers(rel, id);
}else{
closeOtherGroups(rel);
}}
if(jQuery(this).data('togglegroup')!==undefined){
var togname=jQuery(this).data('togglegroup').toString();
if(togname.indexOf('-highlander')!='-1'){
closeOtherTogMembers(togname, id);
}}
if(offset_top){
jQuery('html, body').animate({scrollTop:offset_top}, 500);
}});
jQuery(document).on(com_binding, '.expandall', function(event){
if(jQuery(this).attr('rel')!==undefined){
var rel=jQuery(this).attr('rel');
var loop_items=jQuery('.collapseomatic:not(.colomat-close)[rel="' + rel +'"]');
}
else if(jQuery(this).attr('data-togglegroup')!==undefined){
var toggroup=jQuery(this).attr('data-togglegroup');
var loop_items=jQuery('.collapseomatic:not(.colomat-close)[data-togglegroup="' + toggroup +'"]');
}else{
var loop_items=jQuery('.collapseomatic:not(.colomat-close)');
}
colomat_expandall(loop_items);
});
jQuery(document).on(com_binding, '.collapseall', function(event){
if(jQuery(this).attr('rel')!==undefined){
var rel=jQuery(this).attr('rel');
var loop_items=jQuery('.collapseomatic.colomat-close[rel="' + rel +'"]');
}
else if(jQuery(this).attr('data-togglegroup')!==undefined){
var toggroup=jQuery(this).attr('data-togglegroup');
var loop_items=jQuery('.collapseomatic.colomat-close[data-togglegroup="' + toggroup +'"]');
}else{
var loop_items=jQuery('.collapseomatic.colomat-close');
}
colomat_collapseall(loop_items);
});
var fullurl=document.location.toString();
if(fullurl.match('#(?!\!)')){
hashmaster(fullurl);
}
jQuery(document).on('click', 'a.colomat-nolink', function(event){
event.preventDefault();
});
jQuery(window).on('hashchange', function (e){
fullurl=document.location.toString();
if(fullurl.match('#(?!\!)')){
hashmaster(fullurl);
}});
function hashmaster(fullurl){
if(fullurl.match('#(?!\!)')){
var anchor_arr=fullurl.split(/#(?!\!)/);
if(anchor_arr.length > 1){
junk=anchor_arr.splice(0, 1);
anchor=anchor_arr.join('#');
}else{
anchor=anchor_arr[0];
}
if(jQuery('#' + anchor).length){
jQuery('#' + anchor).parents('.collapseomatic_content').each(function(index){
parent_arr=jQuery(this).attr('id').split('-');
junk=parent_arr.splice(0, 1);
parent=parent_arr.join('-');
if(!jQuery('#' + parent).hasClass('colomat-close')){
jQuery('#' + parent).click();
}})
if(!jQuery('#' + anchor).hasClass('colomat-close')){
jQuery('#' + anchor).click();
}}
if(typeof colomatoffset!=='undefined'){
var anchor_offset=jQuery('#' + anchor).offset();
colomatoffset=colomatoffset + anchor_offset.top;
jQuery('html, body').animate({scrollTop:colomatoffset}, 50);
}}
}});
!function(){"use strict";var t=0,e={};function i(o){if(!o)throw new Error("No options passed to Waypoint constructor");if(!o.element)throw new Error("No element option passed to Waypoint constructor");if(!o.handler)throw new Error("No handler option passed to Waypoint constructor");this.key="waypoint-"+t,this.options=i.Adapter.extend({},i.defaults,o),this.element=this.options.element,this.adapter=new i.Adapter(this.element),this.callback=o.handler,this.axis=this.options.horizontal?"horizontal":"vertical",this.enabled=this.options.enabled,this.triggerPoint=null,this.group=i.Group.findOrCreate({name:this.options.group,axis:this.axis}),this.context=i.Context.findOrCreateByElement(this.options.context),i.offsetAliases[this.options.offset]&&(this.options.offset=i.offsetAliases[this.options.offset]),this.group.add(this),this.context.add(this),e[this.key]=this,t+=1}i.prototype.queueTrigger=function(t){this.group.queueTrigger(this,t)},i.prototype.trigger=function(t){this.enabled&&this.callback&&this.callback.apply(this,t)},i.prototype.destroy=function(){this.context.remove(this),this.group.remove(this),delete e[this.key]},i.prototype.disable=function(){return this.enabled=!1,this},i.prototype.enable=function(){return this.context.refresh(),this.enabled=!0,this},i.prototype.next=function(){return this.group.next(this)},i.prototype.previous=function(){return this.group.previous(this)},i.invokeAll=function(t){var i=[];for(var o in e)i.push(e[o]);for(var n=0,r=i.length;n<r;n++)i[n][t]()},i.destroyAll=function(){i.invokeAll("destroy")},i.disableAll=function(){i.invokeAll("disable")},i.enableAll=function(){for(var t in i.Context.refreshAll(),e)e[t].enabled=!0;return this},i.refreshAll=function(){i.Context.refreshAll()},i.viewportHeight=function(){return window.innerHeight||document.documentElement.clientHeight},i.viewportWidth=function(){return document.documentElement.clientWidth},i.adapters=[],i.defaults={context:window,continuous:!0,enabled:!0,group:"default",horizontal:!1,offset:0},i.offsetAliases={"bottom-in-view":function(){return this.context.innerHeight()-this.adapter.outerHeight()},"right-in-view":function(){return this.context.innerWidth()-this.adapter.outerWidth()}},window.Waypoint=i}(),function(){"use strict";function t(t){window.setTimeout(t,1e3/60)}var e=0,i={},o=window.Waypoint,n=window.onload;function r(t){this.element=t,this.Adapter=o.Adapter,this.adapter=new this.Adapter(t),this.key="waypoint-context-"+e,this.didScroll=!1,this.didResize=!1,this.oldScroll={x:this.adapter.scrollLeft(),y:this.adapter.scrollTop()},this.waypoints={vertical:{},horizontal:{}},t.waypointContextKey=this.key,i[t.waypointContextKey]=this,e+=1,o.windowContext||(o.windowContext=!0,o.windowContext=new r(window)),this.createThrottledScrollHandler(),this.createThrottledResizeHandler()}r.prototype.add=function(t){var e=t.options.horizontal?"horizontal":"vertical";this.waypoints[e][t.key]=t,this.refresh()},r.prototype.checkEmpty=function(){var t=this.Adapter.isEmptyObject(this.waypoints.horizontal),e=this.Adapter.isEmptyObject(this.waypoints.vertical),o=this.element==this.element.window;t&&e&&!o&&(this.adapter.off(".waypoints"),delete i[this.key])},r.prototype.createThrottledResizeHandler=function(){var t=this;function e(){t.handleResize(),t.didResize=!1}this.adapter.on("resize.waypoints",(function(){t.didResize||(t.didResize=!0,o.requestAnimationFrame(e))}))},r.prototype.createThrottledScrollHandler=function(){var t=this;function e(){t.handleScroll(),t.didScroll=!1}this.adapter.on("scroll.waypoints",(function(){t.didScroll&&!o.isTouch||(t.didScroll=!0,o.requestAnimationFrame(e))}))},r.prototype.handleResize=function(){o.Context.refreshAll()},r.prototype.handleScroll=function(){var t={},e={horizontal:{newScroll:this.adapter.scrollLeft(),oldScroll:this.oldScroll.x,forward:"right",backward:"left"},vertical:{newScroll:this.adapter.scrollTop(),oldScroll:this.oldScroll.y,forward:"down",backward:"up"}};for(var i in e){var o=e[i],n=o.newScroll>o.oldScroll?o.forward:o.backward;for(var r in this.waypoints[i]){var s=this.waypoints[i][r];if(null!==s.triggerPoint){var a=o.oldScroll<s.triggerPoint,l=o.newScroll>=s.triggerPoint;(a&&l||!a&&!l)&&(s.queueTrigger(n),t[s.group.id]=s.group)}}}for(var h in t)t[h].flushTriggers();this.oldScroll={x:e.horizontal.newScroll,y:e.vertical.newScroll}},r.prototype.innerHeight=function(){return this.element==this.element.window?o.viewportHeight():this.adapter.innerHeight()},r.prototype.remove=function(t){delete this.waypoints[t.axis][t.key],this.checkEmpty()},r.prototype.innerWidth=function(){return this.element==this.element.window?o.viewportWidth():this.adapter.innerWidth()},r.prototype.destroy=function(){var t=[];for(var e in this.waypoints)for(var i in this.waypoints[e])t.push(this.waypoints[e][i]);for(var o=0,n=t.length;o<n;o++)t[o].destroy()},r.prototype.refresh=function(){var t,e=this.element==this.element.window,i=e?void 0:this.adapter.offset(),n={};for(var r in this.handleScroll(),t={horizontal:{contextOffset:e?0:i.left,contextScroll:e?0:this.oldScroll.x,contextDimension:this.innerWidth(),oldScroll:this.oldScroll.x,forward:"right",backward:"left",offsetProp:"left"},vertical:{contextOffset:e?0:i.top,contextScroll:e?0:this.oldScroll.y,contextDimension:this.innerHeight(),oldScroll:this.oldScroll.y,forward:"down",backward:"up",offsetProp:"top"}}){var s=t[r];for(var a in this.waypoints[r]){var l,h,p,c,u=this.waypoints[r][a],d=u.options.offset,f=u.triggerPoint,w=0,y=null==f;u.element!==u.element.window&&(w=u.adapter.offset()[s.offsetProp]),"function"==typeof d?d=d.apply(u):"string"==typeof d&&(d=parseFloat(d),u.options.offset.indexOf("%")>-1&&(d=Math.ceil(s.contextDimension*d/100))),l=s.contextScroll-s.contextOffset,u.triggerPoint=Math.floor(w+l-d),h=f<s.oldScroll,p=u.triggerPoint>=s.oldScroll,c=!h&&!p,!y&&(h&&p)?(u.queueTrigger(s.backward),n[u.group.id]=u.group):(!y&&c||y&&s.oldScroll>=u.triggerPoint)&&(u.queueTrigger(s.forward),n[u.group.id]=u.group)}}return o.requestAnimationFrame((function(){for(var t in n)n[t].flushTriggers()})),this},r.findOrCreateByElement=function(t){return r.findByElement(t)||new r(t)},r.refreshAll=function(){for(var t in i)i[t].refresh()},r.findByElement=function(t){return i[t.waypointContextKey]},window.onload=function(){n&&n(),r.refreshAll()},o.requestAnimationFrame=function(e){(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||t).call(window,e)},o.Context=r}(),function(){"use strict";function t(t,e){return t.triggerPoint-e.triggerPoint}function e(t,e){return e.triggerPoint-t.triggerPoint}var i={vertical:{},horizontal:{}},o=window.Waypoint;function n(t){this.name=t.name,this.axis=t.axis,this.id=this.name+"-"+this.axis,this.waypoints=[],this.clearTriggerQueues(),i[this.axis][this.name]=this}n.prototype.add=function(t){this.waypoints.push(t)},n.prototype.clearTriggerQueues=function(){this.triggerQueues={up:[],down:[],left:[],right:[]}},n.prototype.flushTriggers=function(){for(var i in this.triggerQueues){var o=this.triggerQueues[i],n="up"===i||"left"===i;o.sort(n?e:t);for(var r=0,s=o.length;r<s;r+=1){var a=o[r];(a.options.continuous||r===o.length-1)&&a.trigger([i])}}this.clearTriggerQueues()},n.prototype.next=function(e){this.waypoints.sort(t);var i=o.Adapter.inArray(e,this.waypoints);return i===this.waypoints.length-1?null:this.waypoints[i+1]},n.prototype.previous=function(e){this.waypoints.sort(t);var i=o.Adapter.inArray(e,this.waypoints);return i?this.waypoints[i-1]:null},n.prototype.queueTrigger=function(t,e){this.triggerQueues[e].push(t)},n.prototype.remove=function(t){var e=o.Adapter.inArray(t,this.waypoints);e>-1&&this.waypoints.splice(e,1)},n.prototype.first=function(){return this.waypoints[0]},n.prototype.last=function(){return this.waypoints[this.waypoints.length-1]},n.findOrCreate=function(t){return i[t.axis][t.name]||new n(t)},o.Group=n}(),function(){"use strict";var t=window.jQuery,e=window.Waypoint;function i(e){this.$element=t(e)}t.each(["innerHeight","innerWidth","off","offset","on","outerHeight","outerWidth","scrollLeft","scrollTop"],(function(t,e){i.prototype[e]=function(){var t=Array.prototype.slice.call(arguments);return this.$element[e].apply(this.$element,t)}})),t.each(["extend","inArray","isEmptyObject"],(function(e,o){i[o]=t[o]})),e.adapters.push({name:"jquery",Adapter:i}),e.Adapter=i}(),function(){"use strict";var t=window.Waypoint;function e(e){return function(){var i=[],o=arguments[0];return"function"==typeof arguments[0]&&((o=e.extend({},arguments[1])).handler=arguments[0]),this.each((function(){var n=e.extend({},o,{element:this});"string"==typeof n.context&&(n.context=e(this).closest(n.context)[0]),i.push(new t(n))})),i}}window.jQuery&&(window.jQuery.fn.waypoint=e(window.jQuery)),window.Zepto&&(window.Zepto.fn.waypoint=e(window.Zepto))}();
if(! Array.isArray){
Array.isArray=function(arg){
return Object.prototype.toString.call(arg)==='[object Array]';
};}
(function($){
"use strict";
const opt={
'bubbles':		true,
'cancelable':	true
};
$(window).on('av-height-change', function(e){
const event=new CustomEvent('avia_height_change', opt);
window.dispatchEvent(event);
});
$('body').on('av_resize_finished', function(e){
const event=new CustomEvent('avia_resize_finished', opt);
document.body.dispatchEvent(event);
});
})(jQuery);
(function($){
"use strict";
$(function(){
$.avia_utilities=$.avia_utilities||{};
AviaBrowserDetection('html');
AviaDeviceDetection('html');
avia_scroll_top_fade();
aviaCalcContentWidth();
new $.AviaTooltip({
"class": 'avia-search-tooltip',
data: 'avia-search-tooltip',
event: 'click',
position: 'bottom',
scope: "body",
attach: 'element',
within_screen: true,
close_keys: 27
});
new $.AviaTooltip({
"class": 'avia-related-tooltip',
data: 'avia-related-tooltip',
scope: ".related_posts, .av-share-box",
attach: 'element',
delay: 0
});
new $.AviaAjaxSearch({scope:'#header, .avia_search_element'});
if($.fn.avia_iso_sort){
$('.grid-sort-container').avia_iso_sort();
}
AviaSidebarShadowHelper();
$.avia_utilities.avia_ajax_call();
$.avia_utilities.postSwipeSupport();
});
$.avia_utilities=$.avia_utilities||{};
$.avia_utilities.postSwipeSupport=function(){
if(! $.fn.avia_swipe_trigger){
return;
}
const	body=document.getElementsByTagName('body'),
methods={};
methods.beforeTrigger=function(slider, direction){
const loader=$.avia_utilities.loading();
loader.show();
};
methods.afterTrigger=function(slider, direction){
let body=document.getElementsByTagName('body');
if(! body.length){
return;
}
let dir=direction=='prev' ? 'swiped-ltr':'swiped-rtl';
body[0].classList.add('av-post-swiped-overlay', dir);
};
if(! body.length||! body[0].classList.contains('avia-post-nav-swipe-enabled') ){
return;
}
let single=document.querySelector('.single #main');
if(single==null){
return;
}
let prev=document.querySelector('#wrap_all .avia-post-nav.avia-post-prev'),
next=document.querySelector('#wrap_all .avia-post-nav.avia-post-next'),
param={
prev: prev,
next: next,
delay_trigger: true,
event: {
prev: 'native_click',
next: 'native_click'
},
beforeTrigger: methods.beforeTrigger,
afterTrigger: methods.afterTrigger
};
$(single).avia_swipe_trigger(param);
};
$.avia_utilities.avia_ajax_call=function(container){
if(typeof container=='undefined'){
container='body';
};
$('a.avianolink').on('click', function(e){ e.preventDefault(); });
$('a.aviablank').attr('target', '_blank');
if($.fn.avia_activate_lightbox){
$(container).avia_activate_lightbox();
}
if($.fn.avia_scrollspy){
if(container=='body'){
$('body').avia_scrollspy({target:'.main_menu .menu li > a'});
}else{
$('body').avia_scrollspy('refresh');
}}
if($.fn.avia_smoothscroll){
$('a[href*="#"]', container).avia_smoothscroll(container);
}
avia_small_fixes(container);
avia_hover_effect(container);
avia_iframe_fix(container);
if($.fn.avia_html5_activation&&$.fn.mediaelementplayer){
$(".avia_video, .avia_audio", container).avia_html5_activation({ratio:'16:9'});
}};
$.avia_utilities.log=function(text, type, extra){
if(typeof console=='undefined'){
return;
}
if(typeof type=='undefined'){
type="log";
}
type="AVIA-" + type.toUpperCase();
console.log("["+type+"] "+text);
if(typeof extra!='undefined'){
console.log(extra);
}};
function aviaCalcContentWidth(){
var win=$(window),
width_select=$('html').is('.html_header_sidebar') ? "#main":"#header",
outer=$(width_select),
outerParent=outer.parents('div').eq(0),
the_main=$(width_select + ' .container').first(),
css_block="",
calc_dimensions=function(){
var css="",
w_12=Math.round(the_main.width()),
w_outer=Math.round(outer.width()),
w_inner=Math.round(outerParent.width());
css +=" #header .three.units{width:"	+(w_12 * 0.25)+	"px;}";
css +=" #header .six.units{width:"		+(w_12 * 0.50)+	"px;}";
css +=" #header .nine.units{width:"	+(w_12 * 0.75)+	"px;}";
css +=" #header .twelve.units{width:"	+(w_12)		+	"px;}";
css +=" .av-framed-box .av-layout-tab-inner .container{width:"	+(w_inner)+	"px;}";
css +=" .html_header_sidebar .av-layout-tab-inner .container{width:"	+(w_outer)+	"px;}";
css +=" .boxed .av-layout-tab-inner .container{width:"	+(w_outer)+	"px;}";
css +=" .av-framed-box#top .av-submenu-container{width:"	+(w_inner)+	"px;}";
try{
css_block.text(css);
}
catch(err){
css_block.remove();
var headFirst=$('head').first();
css_block=$("<style type='text/css' id='av-browser-width-calc'>"+css+"</style>").appendTo(headFirst);
}};
if($('.avia_mega_div').length > 0||$('.av-layout-tab-inner').length > 0||$('.av-submenu-container').length > 0){
var headFirst=$('head').first();
css_block=$("<style type='text/css' id='av-browser-width-calc'></style>").appendTo(headFirst);
win.on('debouncedresize', calc_dimensions);
calc_dimensions();
}}
function AviaSidebarShadowHelper(){
var $sidebar_container=$('.sidebar_shadow#top #main .sidebar');
var $content_container=$('.sidebar_shadow .content');
if($sidebar_container.height() >=$content_container.height()){
$sidebar_container.addClass('av-enable-shadow');
}else{
$content_container.addClass('av-enable-shadow');
}}
function AviaScrollSpy(element, options){
var self=this;
var process=self.process.bind(self),
refresh=self.refresh.bind(self),
$element=$(element).is('body') ? $(window):$(element),
href;
self.$body=$('body');
self.$win=$(window);
self.options=$.extend({}, $.fn.avia_scrollspy.defaults, options);
self.selector=(self.options.target
|| ((href=$(element).attr('href'))&&href.replace(/.*(?=#[^\s]+$)/, ''))
|| '');
self.activation_true=false;
if(self.$body.find(self.selector + "[href*='#']").length){
self.$scrollElement=$element.on('scroll.scroll-spy.data-api', process);
self.$win.on('av-height-change', refresh);
self.$body.on('av_resize_finished', refresh);
self.activation_true=true;
self.checkFirst();
setTimeout(function(){
self.refresh();
self.process();
},100);
}}
AviaScrollSpy.prototype={
constructor: AviaScrollSpy
, checkFirst: function (){
var current=window.location.href.split('#')[0],
matching_link=this.$body.find(this.selector + "[href='"+current+"']").attr('href',current+'#top');
}
, refresh: function (){
if(!this.activation_true) return;
var self=this
, $targets;
this.offsets=$([]);
this.targets=$([]);
$targets=this.$body
.find(this.selector)
.map(function (){
var $el=$(this)
, href=$el.data('target')||$el.attr('href')
, hash=this.hash
, hash=hash.replace(/\//g, "")
, $href=/^#\w/.test(hash)&&$(hash);
var obj=self.$scrollElement.get(0);
var isWindow=obj!=null&&obj===obj.window;
return($href
&& $href.length
&& [[ $href.position().top +(! isWindow&&self.$scrollElement.scrollTop()), href ]])||null;
})
.sort(function (a, b){ return a[0] - b[0]; })
.each(function (){
self.offsets.push(this[0]);
self.targets.push(this[1]);
});
}
, process: function (){
if(!this.offsets) return;
if(isNaN(this.options.offset)) this.options.offset=0;
var scrollTop=this.$scrollElement.scrollTop() + this.options.offset
, scrollHeight=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight
, maxScroll=scrollHeight - this.$scrollElement.height()
, offsets=this.offsets
, targets=this.targets
, activeTarget=this.activeTarget
, i;
if(scrollTop >=maxScroll){
return activeTarget!=(i=targets.last()[0])
&& this.activate(i);
}
for (i=offsets.length; i--;){
activeTarget!=targets[i]
&& scrollTop >=offsets[i]
&& (!offsets[i + 1]||scrollTop <=offsets[i + 1])
&& this.activate(targets[i]);
}}
, activate: function (target){
var active
, selector;
this.activeTarget=target;
$(this.selector)
.parent('.' + this.options.applyClass)
.removeClass(this.options.applyClass);
selector=this.selector
+ '[data-target="' + target + '"],'
+ this.selector + '[href="' + target + '"]';
active=$(selector)
.parent('li')
.addClass(this.options.applyClass);
if(active.parent('.sub-menu').length){
active=active.closest('li.dropdown_ul_available').addClass(this.options.applyClass);
}
active.trigger('activate');
}};
$.fn.avia_scrollspy=function (option){
return this.each(function (){
var $this=$(this)
, data=$this.data('scrollspy')
, options=typeof option=='object'&&option;
if(!data) $this.data('scrollspy', (data=new AviaScrollSpy(this, options)));
if(typeof option=='string') data[option]();
});
};
$.fn.avia_scrollspy.Constructor=AviaScrollSpy;
$.fn.avia_scrollspy.calc_offset=function(){
var 	offset_1=(parseInt($('.html_header_sticky #main').data('scroll-offset'), 10))||0,
offset_2=($(".html_header_sticky:not(.html_top_nav_header) #header_main_alternate").outerHeight())||0,
offset_3=($(".html_header_sticky.html_header_unstick_top_disabled #header_meta").outerHeight())||0,
offset_4=1,
offset_5=parseInt($('html').css('margin-top'),10)||0,
offset_6=parseInt($('.av-frame-top ').outerHeight(),10)||0;
return offset_1 + offset_2 + offset_3 + offset_4 + offset_5 + offset_6;
};
$.fn.avia_scrollspy.defaults =
{
offset: $.fn.avia_scrollspy.calc_offset(),
applyClass: 'current-menu-item'
};
function AviaBrowserDetection(outputClassElement){
var current_browser={},
uaMatch=function(ua){
ua=ua.toLowerCase();
var match=/(edge)\/([\w.]+)/.exec(ua) ||
/(opr)[\/]([\w.]+)/.exec(ua) ||
/(chrome)[ \/]([\w.]+)/.exec(ua) ||
/(iemobile)[\/]([\w.]+)/.exec(ua) ||
/(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) ||
/(webkit)[ \/]([\w.]+)/.exec(ua) ||
/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
/(msie) ([\w.]+)/.exec(ua) ||
ua.indexOf("trident") >=0&&/(rv)(?::|)([\w.]+)/.exec(ua) ||
ua.indexOf("compatible") < 0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
[];
return {
browser: match[ 5 ]||match[ 3 ]||match[ 1 ]||"",
version: match[ 2 ]||match[ 4 ]||"0",
versionNumber: match[ 4 ]||match[ 2 ]||"0"
};};
var matched=uaMatch(navigator.userAgent);
if(matched.browser){
current_browser.browser=matched.browser;
current_browser[ matched.browser ]=true;
current_browser.version=matched.version;
}
if(current_browser.chrome){
current_browser.webkit=true;
}else if(current_browser.webkit){
current_browser.safari=true;
}
if(typeof(current_browser)!=='undefined'){
var bodyclass='',
version=current_browser.version ? parseInt(current_browser.version):"";
if(current_browser.msie||current_browser.rv||current_browser.iemobile){
bodyclass +='avia-msie';
}else if(current_browser.webkit){
bodyclass +='avia-webkit';
}else if(current_browser.mozilla){
bodyclass +='avia-mozilla';
}
if(current_browser.version) bodyclass +=' ' + bodyclass + '-' + version + ' ';
if(current_browser.browser) bodyclass +=' avia-' + current_browser.browser + ' avia-' +current_browser.browser +'-' + version + ' ';
}
if(outputClassElement){
$(outputClassElement).addClass(bodyclass);
}
return bodyclass;
}
function AviaDeviceDetection(outputClassElement){
var classes=[];
$.avia_utilities.isTouchDevice='ontouchstart' in window ||
window.DocumentTouch&&document instanceof window.DocumentTouch ||
navigator.maxTouchPoints > 0 ||
window.navigator.msMaxTouchPoints > 0;
classes.push($.avia_utilities.isTouchDevice ? 'touch-device':'no-touch-device');
$.avia_utilities.pointerDevices=[];
if(typeof window.matchMedia!='function'){
$.avia_utilities.pointerDevices.push('undefined');
classes.push('pointer-device-undefined');
}else{
var pointer_fine=false;
if(window.matchMedia('(any-pointer: fine)') ){
classes.push('pointer-device-fine');
$.avia_utilities.pointerDevices.push('fine');
pointer_fine=true;
}
if(window.matchMedia('(any-pointer: coarse)') ){
classes.push('pointer-device-coarse');
$.avia_utilities.pointerDevices.push('coarse');
if(! pointer_fine){
classes.push('pointer-device-coarse-only');
}}
if(! $.avia_utilities.pointerDevices.length){
classes.push('pointer-device-none');
$.avia_utilities.pointerDevices.push('none');
}}
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;
}}
$(outputClassElement).addClass(classes.join(' '));
}
$.fn.avia_html5_activation=function(options){
var defaults =
{
ratio: '16:9'
};
var options=$.extend(defaults, options);
this.each(function(){
var fv=$(this),
id_to_apply='#' + fv.attr('id'),
posterImg=fv.attr('poster'),
features=[ 'playpause', 'progress', 'current', 'duration', 'tracks', 'volume' ],
container=fv.closest('.avia-video');
if(container.length > 0&&container.hasClass('av-html5-fullscreen-btn') ){
features.push('fullscreen');
}
if(! $(this).prop('controls')){
features=[];
}
fv.mediaelementplayer({
defaultVideoWidth: 480,
defaultVideoHeight: 270,
videoWidth: -1,
videoHeight: -1,
audioWidth: 400,
audioHeight: 30,
startVolume: 0.8,
loop: false,
enableAutosize: false,
features: features,
alwaysShowControls: false,
iPadUseNativeControls: false,
iPhoneUseNativeControls: false,
AndroidUseNativeControls: false,
alwaysShowHours: false,
showTimecodeFrameCount: false,
framesPerSecond: 25,
enableKeyboard: true,
pauseOtherPlayers: false,
poster: posterImg,
success: function(mediaElement, domObject, instance){
$.AviaVideoAPI.players[ fv.attr('id').replace(/_html5/,'') ]=instance;
setTimeout(function(){
if(mediaElement.pluginType=='flash'){
mediaElement.addEventListener('canplay', function(){ fv.trigger('av-mediajs-loaded'); }, false);
}else{
fv.trigger('av-mediajs-loaded').addClass('av-mediajs-loaded');
}
mediaElement.addEventListener('ended', function(){  fv.trigger('av-mediajs-ended'); }, false);
var html5MediaElement=document.getElementById($(mediaElement).attr('id') + '_html5');
if(html5MediaElement&&html5MediaElement!==mediaElement){
mediaElement.addEventListener("ended", function(){
$(html5MediaElement).trigger('av-mediajs-ended');
});
}}, 10);
},
error: function(){
},
keyActions: []
});
});
};
function avia_hover_effect(container){
if($.avia_utilities.isMobile){
return;
}
if($('body').hasClass('av-disable-avia-hover-effect') ){
return;
}
var overlay="",
cssTrans=$.avia_utilities.supports('transition'),
elements=[];
if(container=='body'){
elements=$('#main a img').parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .ls-wp-container a, .noHover, .noHover a, .av-logo-container .logo a').add('#main .avia-hover-fx');
}else{
elements=$('a img', container).parents('a').not('.noLightbox, .noLightbox a, .avia-gallery-thumb a, .ls-wp-container a, .noHover, .noHover a, .av-logo-container .logo a').add('.avia-hover-fx', container);
}
elements.each(function(e){
var link=$(this),
current=link.find('img').first();
if(current.hasClass('alignleft')){
link.addClass('alignleft').css({float:'left', margin:0, padding:0});
}
if(current.hasClass('alignright')){
link.addClass('alignright').css({float:'right', margin:0, padding:0});
}
if(current.hasClass('aligncenter')){
link.addClass('aligncenter').css({float:'none','text-align':'center', margin:0, padding:0});
}
if(current.hasClass('alignnone')){
link.addClass('alignnone').css({margin:0, padding:0});
if(! link.css('display')||link.css('display')=='inline'){
link.css({display:'inline-block'});
}}
if(! link.css('position')||link.css('position')=='static'){
link.css({position:'relative', overflow:'hidden'});
}
var url=link.attr('href'),
span_class="overlay-type-video",
opa=link.data('opacity')||0.7,
overlay_offset=5,
overlay=link.find('.image-overlay');
if(url){
if(url.match(/(jpg|gif|jpeg|png|tif)/)){
span_class="overlay-type-image";
}
if(! url.match(/(jpg|gif|jpeg|png|\.tif|\.mov|\.swf|vimeo\.com|youtube\.com)/)){
span_class="overlay-type-extern";
}}
if(! overlay.length){
overlay=$("<span class='image-overlay "+span_class+"'><span class='image-overlay-inside'></span></span>").appendTo(link);
}
link.on('mouseenter', function(e){
var current=link.find('img').first(),
_self=current.get(0),
outerH=current.outerHeight(),
outerW=current.outerWidth(),
pos=current.position(),
linkCss=link.css('display'),
overlay=link.find('.image-overlay');
if(outerH > 100){
if(!overlay.length){
overlay=$("<span class='image-overlay "+span_class+"'><span class='image-overlay-inside'></span></span>").appendTo(link);
}
if(link.height()==0){
link.addClass(_self.className); _self.className="";
}
if(! linkCss||linkCss=='inline'){
link.css({display:'block'});
}
overlay.css({left:(pos.left - overlay_offset) + parseInt(current.css("margin-left"),10), top:pos.top + parseInt(current.css("margin-top"),10)})
.css({overflow:'hidden',display:'block','height':outerH,'width':(outerW + (2*overlay_offset))});
if(cssTrans===false){
overlay.stop().animate({opacity:opa}, 400);
}}else{
overlay.css({display:"none"});
}}).on('mouseleave', elements, function(){
if(overlay.length){
if(cssTrans===false){
overlay.stop().animate({opacity:0}, 400);
}}
});
});
}
(function($){
$.fn.avia_smoothscroll=function(apply_to_container){
if(! this.length){
return;
}
var the_win=$(window),
$header=$('#header'),
$main=$('.html_header_top.html_header_sticky #main').not('.page-template-template-blank-php #main'),
$meta=$('.html_header_top.html_header_unstick_top_disabled #header_meta'),
$alt=$('.html_header_top:not(.html_top_nav_header) #header_main_alternate'),
menu_above_logo=$('.html_header_top.html_top_nav_header'),
shrink=$('.html_header_top.html_header_shrinking').length,
frame=$('.av-frame-top'),
fixedMainPadding=0,
isMobile=$.avia_utilities.isMobile,
sticky_sub=$('.sticky_placeholder').first(),
calc_main_padding=function(){
if($header.css('position')=="fixed"){
var tempPadding=parseInt($main.data('scroll-offset'),10)||0,
non_shrinking=parseInt($meta.outerHeight(),10)||0,
non_shrinking2=parseInt($alt.outerHeight(),10)||0;
if(tempPadding > 0&&shrink){
tempPadding=(tempPadding / 2) + non_shrinking + non_shrinking2;
}else{
tempPadding=tempPadding + non_shrinking + non_shrinking2;
}
tempPadding +=parseInt($('html').css('margin-top'),10);
fixedMainPadding=tempPadding;
}else{
fixedMainPadding=parseInt($('html').css('margin-top'),10);
}
if(frame.length){
fixedMainPadding +=frame.height();
}
if(menu_above_logo.length){
fixedMainPadding=$('.html_header_sticky #header_main_alternate').height() + parseInt($('html').css('margin-top'),10);
}
if(isMobile){
fixedMainPadding=0;
}};
if(isMobile){
shrink=false;
}
calc_main_padding();
the_win.on("debouncedresize av-height-change", calc_main_padding);
var hash=window.location.hash.replace(/\//g, "");
if(fixedMainPadding > 0&&hash&&apply_to_container=='body'&&hash.charAt(1)!="!"&&hash.indexOf("=")===-1){
var scroll_to_el=$(hash), modifier=0;
if(scroll_to_el.length){
the_win.on('scroll.avia_first_scroll', function(){
setTimeout(function(){
if(sticky_sub.length&&scroll_to_el.offset().top > sticky_sub.offset().top){
modifier=sticky_sub.outerHeight() - 3;
}
the_win.off('scroll.avia_first_scroll').scrollTop(scroll_to_el.offset().top - fixedMainPadding - modifier);
},10);
});
}}
return this.each(function(){
$(this).on('click', function(e){
var newHash=this.hash.replace(/\//g, ""),
clicked=$(this),
data=clicked.data(),
ignoreScroll=false,
noScrolInViewport='undefined'!=typeof data.no_scroll_in_viewport&&data.no_scroll_in_viewport==1,
ignoreHash='undefined'!=typeof data.ignore_hash&&data.ignore_hash==1;
if(newHash!=''&&newHash!='#'&&newHash!='#prev'&&newHash!='#next'&&!clicked.is('.comment-reply-link, #cancel-comment-reply-link, .no-scroll')){
var container="",
originHash="";
if('#next-section'==newHash){
originHash=newHash;
var next_containers=clicked.parents('.container_wrap').eq(0).nextAll('.container_wrap');
next_containers.each(function(){
var cont=$(this);
if(cont.css('display')=='none'||cont.css('visibility')=='hidden'){
return;
}
container=cont;
return false;
});
if('object'==typeof container&&container.length > 0){
newHash='#' + container.attr('id') ;
}}else{
container=$(this.hash.replace(/\//g, ""));
}
if(container.length&&noScrolInViewport){
const rect=container[0].getBoundingClientRect();
if(rect.top > fixedMainPadding&&(rect.top < (window.innerHeight||document.documentElement.clientHeight)) ){
ignoreScroll=true;
}}
if(container.length&&! ignoreScroll){
var cur_offset=the_win.scrollTop(),
container_offset=container.offset().top,
target=container_offset - fixedMainPadding,
hash=window.location.hash,
hash=hash.replace(/\//g, ""),
oldLocation=window.location.href.replace(hash, ''),
newLocation=this,
duration=data.duration||1200,
easing=data.easing||'easeInOutQuint';
if(sticky_sub.length&&container_offset > sticky_sub.offset().top){
target -=sticky_sub.outerHeight() - 3;
}
if('undefined'!=typeof data.scroll_top_offset&&Number.isInteger(data.scroll_top_offset) ){
target -=data.scroll_top_offset;
}
if(oldLocation + newHash==newLocation||originHash){
if(cur_offset!=target){
if(!(cur_offset==0&&target <=0) ){
the_win.trigger('avia_smooth_scroll_start');
$('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function(){
the_win.trigger('avia_smooth_scroll_end');
if(! ignoreHash){
if(window.history.replaceState){
window.history.replaceState("", "", newHash);
}}
});
}}
e.preventDefault();
}}
}});
});
};})(jQuery);
function avia_iframe_fix(container){
var iframe=jQuery('iframe[src*="youtube.com"]:not(.av_youtube_frame)', container),
youtubeEmbed=jQuery('iframe[src*="youtube.com"]:not(.av_youtube_frame) object, iframe[src*="youtube.com"]:not(.av_youtube_frame) embed', container).attr('wmode','opaque');
iframe.each(function(){
var current=jQuery(this),
src=current.attr('src');
if(src){
if(src.indexOf('?')!==-1){
src +="&wmode=opaque&rel=0";
}else{
src +="?wmode=opaque&rel=0";
}
current.attr('src', src);
}});
}
function avia_small_fixes(container){
if(!container) container=document;
var win=jQuery(window),
iframes=jQuery('.avia-iframe-wrap iframe:not(.avia-slideshow iframe):not(iframe.no_resize):not(.avia-video iframe):not(.wp-embedded-content)', container),
adjust_iframes=function(){
iframes.each(function(){
var iframe=jQuery(this), parent=iframe.parent(), proportions=56.25;
if(this.width&&this.height){
proportions=(100/ this.width) * this.height;
parent.css({"padding-bottom":proportions+"%"});
}});
};
adjust_iframes();
}
function avia_scroll_top_fade(){
var win=$(window),
timeo=false,
scroll_top=$('#scroll-top-link'),
set_status=function(){
var st=win.scrollTop();
if(st < 500){
scroll_top.removeClass('avia_pop_class');
}
else if(!scroll_top.is('.avia_pop_class')){
scroll_top.addClass('avia_pop_class');
}};
win.on('scroll',  function(){ window.requestAnimationFrame(set_status); });
set_status();
}
$.AviaAjaxSearch=function(options){
var defaults={
delay: 300,
minChars: 3,
scope: 'body'
};
this.options=$.extend({}, defaults, options);
this.scope=$(this.options.scope);
this.timer=false;
this.lastVal="";
this.bind_events();
};
$.AviaAjaxSearch.prototype =
{
bind_events: function(){
this.scope.on('keyup', '#s:not(".av_disable_ajax_search #s")', this.try_search.bind(this) );
this.scope.on('click', '#s.av-results-parked', this.reset.bind(this) );
},
try_search: function(e){
var form=$(e.currentTarget).parents('form').eq(0),
resultscontainer=form.find('.ajax_search_response');
clearTimeout(this.timer);
if(e.keyCode===27){
this.reset(e);
return;
}
if(e.currentTarget.value.length >=this.options.minChars&&this.lastVal!=e.currentTarget.value.trim()){
this.timer=setTimeout(this.do_search.bind(this, e), this.options.delay);
}
else if(e.currentTarget.value.length==0){
this.timer=setTimeout(this.reset.bind(this, e), this.options.delay);
}},
reset: function(e){
var form=$(e.currentTarget).parents('form').eq(0),
resultscontainer=form.find('.ajax_search_response'),
alternative_resultscontainer=$(form.attr('data-ajaxcontainer')).find('.ajax_search_response'),
searchInput=$(e.currentTarget);
if($(e.currentTarget).hasClass('av-results-parked')){
resultscontainer.show();
alternative_resultscontainer.show();
$('body > .ajax_search_response').show();
}else{
resultscontainer.remove();
alternative_resultscontainer.remove();
searchInput.val('');
$('body > .ajax_search_response').remove();
}},
do_search: function(e){
var obj=this,
currentField=$(e.currentTarget).attr("autocomplete", "off"),
currentFieldWrapper=$(e.currentTarget).parents('.av_searchform_wrapper').eq(0),
currentField_position=currentFieldWrapper.offset(),
currentField_width=currentFieldWrapper.outerWidth(),
currentField_height=currentFieldWrapper.outerHeight(),
form=currentField.parents('form').eq(0),
submitbtn=form.find('#searchsubmit'),
resultscontainer=form,
results=resultscontainer.find('.ajax_search_response'),
loading=$('<div class="ajax_load"><span class="ajax_load_inner"></span></div>'),
action=form.attr('action'),
values=form.serialize(),
elementID=form.data('element_id'),
custom_color=form.data('custom_color');
values +='&action=avia_ajax_search';
if(! results.length){
results=$('<div class="ajax_search_response" style="display:none;"></div>');
}
if('undefined'!=typeof elementID){
results.addClass(elementID);
}
if('undefined'!=typeof custom_color&&custom_color!=''){
results.addClass('av_has_custom_color');
}
if(form.attr('id')=='searchform_element'){
results.addClass('av_searchform_element_results');
}
if(action.indexOf('?')!=-1){
action=action.split('?');
values +="&" + action[1];
}
if(form.attr('data-ajaxcontainer')){
var rescon=form.attr('data-ajaxcontainer');
if($(rescon).length){
$(rescon).find('.ajax_search_response').remove();
resultscontainer=$(rescon);
}}
results_css={};
if(form.hasClass('av_results_container_fixed')){
$('body').find('.ajax_search_response').remove();
resultscontainer=$('body');
var results_css={
top: currentField_position.top + currentField_height,
left: currentField_position.left,
width: currentField_width
};
results.addClass('main_color');
$(window).resize(function(){
results.remove();
this.reset.bind(this);
currentField.val('');
});
}
if(form.attr('data-results_style')){
var results_style=JSON.parse(form.attr('data-results_style'));
results_css=Object.assign(results_css, results_style);
if("color" in results_css){
results.addClass('av_has_custom_color');
}}
results.css(results_css);
if(resultscontainer.hasClass('avia-section')){
results.addClass('container');
}
results.appendTo(resultscontainer);
if(results.find('.ajax_not_found').length&&e.currentTarget.value.indexOf(this.lastVal)!=-1){
return;
}
this.lastVal=e.currentTarget.value;
$.ajax({
url: avia_framework_globals.ajaxurl,
type: "POST",
data:values,
beforeSend: function(){
loading.insertAfter(submitbtn);
form.addClass('ajax_loading_now');
},
success: function(response){
if(response==0){
response="";
}
results.html(response).show();
},
complete: function(){
loading.remove();
form.removeClass('ajax_loading_now');
}});
$(document).on('click',function(e){
if(!$(e.target).closest(form).length){
if($(results).is(":visible")){
$(results).hide();
currentField.addClass('av-results-parked');
}}
});
}};
$.AviaTooltip=function(options){
var defaults={
delay: 1500,
delayOut: 300,
delayHide: 0,
"class": "avia-tooltip",
scope: "body",
data:  "avia-tooltip",
attach: "body",          	//either attach the tooltip to the "mouse" or to the "element" // todo: implement mouse, make sure that it doesnt overlap with screen borders
event: 'mouseenter',
position: 'top',
extraClass: 'avia-tooltip-class',
permanent: false,
within_screen: false,
close_keys: null
};
this.options=$.extend({}, defaults, options);
var close_keys='';
if(this.options.close_keys!=null){
if(! Array.isArray(this.options.close_keys) ){
this.options.close_keys=[ this.options.close_keys ];
}
close_keys=' data-close-keys="' + this.options.close_keys.join(',') + '" ';
}
this.body=$('body');
this.scope=$(this.options.scope);
this.tooltip=$('<div class="' + this.options['class'] + ' avia-tt"' + close_keys + '><span class="avia-arrow-wrap"><span class="avia-arrow"></span></span></div>');
this.inner=$('<div class="inner_tooltip"></div>').prependTo(this.tooltip);
this.open=false;
this.timer=false;
this.active=false;
this.bind_events();
};
$.AviaTooltip.openTTs=[];
$.AviaTooltip.openTT_Elements=[];
$.AviaTooltip.prototype =
{
bind_events: function(){
var perma_tooltips='.av-permanent-tooltip [data-'+this.options.data+']',
default_tooltips='[data-'+this.options.data+']:not(.av-permanent-tooltip [data-'+this.options.data+'])';
this.scope.on('av_permanent_show', perma_tooltips, this.display_tooltip.bind(this) );
$(perma_tooltips).addClass('av-perma-tooltip').trigger('av_permanent_show');
this.scope.on(this.options.event + ' mouseleave', default_tooltips, this.start_countdown.bind(this) );
if(this.options.event!='click'){
this.scope.on('mouseleave', default_tooltips, this.hide_tooltip.bind(this) );
this.scope.on('click', default_tooltips, this.hide_on_click_tooltip.bind(this) );
}else{
this.body.on('mousedown', this.hide_tooltip.bind(this) );
}
if(this.options.close_keys!=null){
this.body.on('keyup', this.close_on_keyup.bind(this) );
}},
start_countdown: function(e){
clearTimeout(this.timer);
var target=this.options.event=="click" ? e.target:e.currentTarget,
element=$(target);
if(e.type==this.options.event){
var delay=this.options.event=='click' ? 0:this.open ? 0:this.options.delay;
this.timer=setTimeout(this.display_tooltip.bind(this, e), delay);
}
else if(e.type=='mouseleave'){
if(! element.hasClass('av-close-on-click-tooltip') ){
this.timer=setTimeout(this.stop_instant_open.bind(this, e), this.options.delayOut);
}}
e.preventDefault();
},
reset_countdown: function(e){
clearTimeout(this.timer);
this.timer=false;
},
display_tooltip: function(e){
let _self=this,
target=this.options.event=="click" ? e.target:e.currentTarget,
text=$(target).data(this.options.data);
text='string'==typeof text ? text.trim():'';
if($('header').hasClass('av_header_transparency')){
if(text==''){
target=e.currentTarget;
text=$(target).data(this.options.data);
text='string'==typeof text ? text.trim():'';
}}
let	element=$(target),
tip_index=element.data('avia-created-tooltip'),
extraClass=element.data('avia-tooltip-class'),
attach=this.options.attach=='element' ? element:this.body,
offset=this.options.attach=='element' ? element.position():element.offset(),
position=element.data('avia-tooltip-position'),
align=element.data('avia-tooltip-alignment'),
force_append=false,
newTip=false,
is_new_tip=false;
if(element.is('.av-perma-tooltip')){
offset={ top:0, left:0 };
attach=element;
force_append=true;
}
if(text==''){
return;
}
if(position==""||typeof position=='undefined'){
position=this.options.position;
}
if(align==""||typeof align=='undefined'){
align='center';
}
if(typeof tip_index!='undefined'){
newTip=$.AviaTooltip.openTTs[tip_index];
}else{
this.inner.html(text);
newTip=this.tooltip.clone();
is_new_tip=true;
if(this.options.attach=='element'&&force_append!==true){
newTip.insertAfter(attach);
}else{
newTip.appendTo(attach);
}
if(extraClass!=""){
newTip.addClass(extraClass);
}}
if(this.open&&this.active==newTip){
return;
}
if(element.hasClass('av-close-on-click-tooltip') ){
this.hide_all_tooltips();
}
this.open=true;
this.active=newTip;
if(( newTip.is(':animated:visible')&&e.type=='click')||element.is('.' + this.options['class'])||element.parents('.' + this.options['class']).length!=0){
return;
}
var animate1={},
animate2={},
pos1="",
pos2="";
if(position=="top"||position=="bottom"){
switch(align){
case "left":
pos2=offset.left;
break;
case "right":
pos2=offset.left + element.outerWidth() - newTip.outerWidth();
break;
default:
pos2=(offset.left +(element.outerWidth() / 2) ) -(newTip.outerWidth() / 2);
break;
}
if(_self.options.within_screen){
var boundary=element.offset().left + (element.outerWidth() / 2) - (newTip.outerWidth() / 2) + parseInt(newTip.css('margin-left'),10);
if(boundary < 0){
pos2=pos2 - boundary;
}}
}else{
switch(align){
case "top":
pos1=offset.top;
break;
case "bottom":
pos1=offset.top + element.outerHeight() - newTip.outerHeight();
break;
default:
pos1=(offset.top + (element.outerHeight() / 2) ) -(newTip.outerHeight() / 2);
break;
}}
switch(position){
case "top":
pos1=offset.top - newTip.outerHeight();
animate1={top: pos1 - 10, left: pos2};
animate2={top: pos1};
break;
case "bottom":
pos1=offset.top + element.outerHeight();
animate1={top: pos1 + 10, left: pos2};
animate2={top: pos1};
break;
case "left":
pos2=offset.left  - newTip.outerWidth();
animate1={top: pos1, left: pos2 -10};
animate2={left: pos2};
break;
case "right":
pos2=offset.left + element.outerWidth();
animate1={top: pos1, left: pos2 + 10};
animate2={left: pos2};
break;
}
animate1['display']="block";
animate1['opacity']=0;
animate2['opacity']=1;
newTip.css(animate1).stop().animate(animate2,200);
newTip.find('input, textarea').trigger('focus');
if(is_new_tip){
$.AviaTooltip.openTTs.push(newTip);
$.AviaTooltip.openTT_Elements.push(element);
element.data('avia-created-tooltip', $.AviaTooltip.openTTs.length - 1);
}},
hide_on_click_tooltip: function(e){
if(this.options.event=="click"){
return;
}
var element=$(e.currentTarget);
if(! element.hasClass('av-close-on-click-tooltip')){
return;
}
if(! element.find('a') ){
e.preventDefault();
}
var ttip_index=element.data('avia-created-tooltip');
if('undefined'!=typeof ttip_index){
var current=$.AviaTooltip.openTTs[ttip_index];
if('undefined'!=typeof current&&current==this.active){
this.hide_all_tooltips();
}}
},
close_on_keyup: function(e){
if(this.options.close_keys==null){
return;
}
if($.inArray(e.keyCode, this.options.close_keys) < 0){
return;
}
this.hide_all_tooltips(e.keyCode);
},
hide_all_tooltips: function(keyCode){
var ttip,
position,
element,
keyCodeCheck='undefined'!=typeof keyCode ? keyCode + '':null;
for(var index=0; index < $.AviaTooltip.openTTs.length; ++index){
ttip=$.AviaTooltip.openTTs[index];
element=$.AviaTooltip.openTT_Elements[index];
position=element.data('avia-tooltip-position');
if(keyCodeCheck!=null){
var keys=ttip.data('close-keys');
if('undefined'==typeof keys){
continue;
}
keys=keys + '';
keys=keys.split(',');
if($.inArray(keyCodeCheck, keys) < 0){
continue;
}}
this.animate_hide_tooltip(ttip, position);
}
this.open=false;
this.active=false;
},
hide_tooltip: function(e){
var element=$(e.currentTarget) , newTip, animateTo,
position=element.data('avia-tooltip-position'),
align=element.data('avia-tooltip-alignment'),
newTip=false;
if(position==""||typeof position=='undefined'){
position=this.options.position;
}
if(align==""||typeof align=='undefined'){
align='center';
}
if(this.options.event=='click'){
element=$(e.target);
if(! element.is('.' + this.options['class'])&&element.parents('.' + this.options['class']).length==0){
if(this.active.length){
newTip=this.active;
this.active=false;
}}
}else{
if(! element.hasClass('av-close-on-click-tooltip') ){
newTip=element.data('avia-created-tooltip');
newTip=typeof newTip!='undefined' ? $.AviaTooltip.openTTs[newTip]:false;
}}
this.animate_hide_tooltip(newTip, position);
},
animate_hide_tooltip: function(ttip, position){
if(ttip){
var animate={opacity:0};
switch(position){
case "top":
animate['top']=parseInt(ttip.css('top'),10) - 10;
break;
case "bottom":
animate['top']=parseInt(ttip.css('top'),10) + 10;
break;
case "left":
animate['left']=parseInt(ttip.css('left'), 10) - 10;
break;
case "right":
animate['left']=parseInt(ttip.css('left'), 10) + 10;
break;
}
ttip.animate(animate, 200, function(){
ttip.css({display:'none'});
});
}},
stop_instant_open: function(e){
this.open=false;
}};})(jQuery);
(function($){
"use strict";
$(function(){
$.event.special.touchstart={
setup: function(_, ns, handle){
this.addEventListener("touchstart", handle, { passive: !ns.includes("noPreventDefault") });
}};
$.event.special.touchmove={
setup: function(_, ns, handle){
this.addEventListener("touchmove", handle, { passive: !ns.includes("noPreventDefault") });
}};
$.event.special.wheel={
setup: function(_, ns, handle){
this.addEventListener("wheel", handle, { passive: true });
}};
$.event.special.mousewheel={
setup: function(_, ns, handle){
this.addEventListener("mousewheel", handle, { passive: true });
}};});
})(jQuery);
(function(){var lastTime=0;var vendors=['ms','moz','webkit','o'];for(var x=0;x<vendors.length&&!window.requestAnimationFrame;++x){window.requestAnimationFrame=window[vendors[x]+'RequestAnimationFrame'];window.cancelAnimationFrame=window[vendors[x]+'CancelAnimationFrame']||window[vendors[x]+'CancelRequestAnimationFrame']}if(!window.requestAnimationFrame)window.requestAnimationFrame=function(callback,element){var currTime=new Date().getTime();var timeToCall=Math.max(0,16-(currTime-lastTime));var id=window.setTimeout(function(){callback(currTime+timeToCall)},timeToCall);lastTime=currTime+timeToCall;return id};if(!window.cancelAnimationFrame)window.cancelAnimationFrame=function(id){clearTimeout(id)}}());
jQuery.expr.pseudos.regex=function(elem, index, match){
var matchParams=match[3].split(','),
validLabels=/^(data|css):/,
attr={
method: matchParams[0].match(validLabels) ? matchParams[0].split(':')[0]:'attr',
property: matchParams.shift().replace(validLabels,'')
},
regexFlags='ig',
regex=new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
return regex.test(jQuery(elem)[attr.method](attr.property));
};
(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";
$(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;
}}
if($.fn.avia_mobile_fixed){
$('.avia-bg-style-fixed').avia_mobile_fixed();
}
if($.fn.avia_browser_height){
$('.av-minimum-height, .avia-fullscreen-slider, .av-cell-min-height').avia_browser_height();
}
if($.fn.avia_container_height){
$('.av-column-min-height-pc').avia_container_height();
}
if($.fn.avia_video_section){
$('.av-section-with-video-bg').avia_video_section();
}
new $.AviaTooltip({'class': "avia-tooltip", data: "avia-tooltip", delay:0, scope: "body"});
new $.AviaTooltip({'class': "avia-tooltip avia-icon-tooltip", data: "avia-icon-tooltip", delay:0, scope: "body"});
$.avia_utilities.activate_shortcode_scripts();
if($.fn.layer_slider_height_helper){
$('.avia-layerslider').layer_slider_height_helper();
}
if($.fn.avia_portfolio_preview){
$('.grid-links-ajax').avia_portfolio_preview();
}
if($.fn.avia_masonry){
$('.av-masonry').avia_masonry();
}
if($.fn.aviaccordion){
$('.aviaccordion').aviaccordion();
}
if($.fn.avia_textrotator){
$('.av-rotator-container').avia_textrotator();
}
if($.fn.avia_sc_tab_section){
$('.av-tab-section-container').avia_sc_tab_section();
}
if($.fn.avia_hor_gallery){
$('.av-horizontal-gallery').avia_hor_gallery();
}
if($.fn.avia_link_column){
$('.avia-link-column').avia_link_column();
}
if($.fn.avia_delayed_animation_in_container){
$('.av-animation-delay-container').avia_delayed_animation_in_container();
}});
$.avia_utilities=$.avia_utilities||{};
$.avia_utilities.activate_shortcode_scripts=function(container){
if(typeof container=='undefined'){
container='body';
}
if($.fn.avia_ajax_form){
$('.avia_ajax_form:not(.avia-disable-default-ajax)', container).avia_ajax_form();
}
activate_waypoints(container);
if($.fn.aviaVideoApi){
$('.avia-slideshow iframe[src*="youtube.com"], .av_youtube_frame, .av_vimeo_frame, .avia-slideshow video').aviaVideoApi({}, 'li');
}
if($.fn.avia_sc_toggle){
$('.togglecontainer', container).avia_sc_toggle();
}
if($.fn.avia_sc_tabs){
$('.top_tab', container).avia_sc_tabs();
$('.sidebar_tab', container).avia_sc_tabs({sidebar:true});
}
if($.fn.avia_sc_gallery){
$('.avia-gallery', container).avia_sc_gallery();
}
if($.fn.avia_sc_animated_number){
$('.avia-animated-number', container).avia_sc_animated_number();
}
if($.fn.avia_sc_animation_delayed){
$('.av_font_icon', container).avia_sc_animation_delayed({delay:100});
$('.avia-image-container', container).avia_sc_animation_delayed({delay:100});
$('.av-hotspot-image-container', container).avia_sc_animation_delayed({delay:100});
$('.av-animated-generic', container).avia_sc_animation_delayed({delay:100});
$('.av-animated-when-visible', container).avia_sc_animation_delayed({delay:100});
$('.av-animated-when-almost-visible', container).avia_sc_animation_delayed({delay:100});
$('.av-animated-when-visible-95', container).avia_sc_animation_delayed({delay:100});
}
if($.fn.avia_sc_iconlist){
$('.avia-icon-list.av-iconlist-big.avia-iconlist-animate', container).avia_sc_iconlist();
}
if($.fn.avia_sc_progressbar){
$('.avia-progress-bar-container', container).avia_sc_progressbar();
}
if($.fn.avia_sc_testimonial){
$('.avia-testimonial-wrapper', container).avia_sc_testimonial();
}
if($.fn.aviaFullscreenSlider){
$('.avia-slideshow.av_fullscreen', container).aviaFullscreenSlider();
}
if($.fn.aviaSlider){
$('.avia-slideshow:not(.av_fullscreen)', container).aviaSlider();
$('.avia-content-slider-active', container).aviaSlider({wrapElement: '.avia-content-slider-inner', slideElement: '.slide-entry-wrap', fullfade: true});
$('.avia-slider-testimonials', container).aviaSlider({wrapElement: '.avia-testimonial-row', slideElement: '.avia-testimonial', fullfade: true});
}
if($.fn.aviaMagazine){
$('.av-magazine-tabs-active', container).aviaMagazine();
}
if($.fn.aviaHotspots){
$('.av-hotspot-image-container', container).aviaHotspots();
}
if($.fn.aviaCountdown){
$('.av-countdown-timer', container).aviaCountdown();
}
if($.fn.aviaPlayer){
$('.av-player', container).aviaPlayer();
}
if($.fn.aviaIconCircles){
$('.av-icon-circles-container').aviaIconCircles();
}
if($.fn.avia_sc_icongrid){
$('.avia-icon-grid-container').avia_sc_icongrid();
}};
function activate_waypoints(container){
if($.fn.avia_waypoints){
if(typeof container=='undefined'){
container='body';
}
$('.avia_animate_when_visible', container).avia_waypoints();			//  'bottom-in-view'
$('.avia_animate_when_almost_visible', container).avia_waypoints({ offset: '80%'});
$('.av-animated-when-visible', container).avia_waypoints();
$('.av-animated-when-almost-visible', container).avia_waypoints({ offset: '80%'});
$('.av-animated-when-visible-95', container).avia_waypoints({ offset: '95%'});
var custom_animated=$('*[class*="av-custom-animated-top-"]', container);
custom_animated.each(function(){
var element=$(this),
classArray=element[ 0 ].className.split(/\s+/);
for(var i=0; i < classArray.length; i++){
if(classArray[i].indexOf('av-custom-animated-top-')==0){
var pct=parseInt(classArray[i].replace('av-custom-animated-top-', '') );
if(! isNaN(pct)&&pct < 100){
element.avia_waypoints({ offset: pct + '%'});
}}
}});
var disable_mobile=$('body').hasClass('avia-mobile-no-animations');
if(container=='body'&&disable_mobile){
container='.avia_desktop body';
}
$('.av-animated-generic', container).avia_waypoints({ offset: '95%'});
}};
$.fn.avia_mobile_fixed=function(options){
var isMobile=$.avia_utilities.isMobile;
if(! isMobile){
return;
}
return this.each(function(){
var current=$(this).addClass('av-parallax-section'),
$background=current.attr('style'),
$attachment_class=current.data('section-bg-repeat'),
template="";
if($attachment_class=='stretch'||$attachment_class=='no-repeat'){
$attachment_class=" avia-full-stretch";
}else{
$attachment_class="";
}
template="<div class='av-parallax " + $attachment_class + "' data-avia-parallax-ratio='0.0' style='" + $background + "' ></div>";
current.prepend(template);
current.attr('style','');
});
};
$.fn.avia_sc_animation_delayed=function(options){
var global_timer=0,
delay=options.delay||50,
max_timer=10,
new_max=setTimeout(function(){ max_timer=20; }, 500);
return this.each(function(){
var elements=$(this);
elements.on('avia_start_animation', function(){
var element=$(this);
if(global_timer < max_timer){
global_timer ++;
}
setTimeout(function(){
element.addClass('avia_start_delayed_animation');
if(global_timer > 0){
global_timer --;
}},(global_timer * delay) );
});
});
};
$.fn.avia_delayed_animation_in_container=function(options){
return this.each(function(){
var elements=$(this);
elements.on('avia_start_animation_if_current_slide_is_active', function(){
var current=$(this),
animate=current.find('.avia_start_animation_when_active');
animate.addClass('avia_start_animation').trigger('avia_start_animation');
});
elements.on('avia_remove_animation', function(){
var current=$(this),
animate=current.find('.avia_start_animation_when_active, .avia_start_animation');
animate.removeClass('avia_start_animation avia_start_delayed_animation');
});
});
};
$.fn.avia_browser_height=function(){
if(! this.length){
return this;
}
var win=$(window),
html_el=$('html'),
headFirst=$('head').first(),
subtract=$('#wpadminbar, #header.av_header_top:not(.html_header_transparency #header), #main>.title_container'),
css_block=$("<style type='text/css' id='av-browser-height'></style>").appendTo(headFirst),
sidebar_menu=$('.html_header_sidebar #top #header_main'),
full_slider=$('.html_header_sidebar .avia-fullscreen-slider.avia-builder-el-0.avia-builder-el-no-sibling').addClass('av-solo-full'),
pc_heights=[ 25, 50, 75 ],
calc_height=function(){
let css='',
wh100=win.height(),
ww100=win.width(),
wh100_mod=wh100,
whCover=(wh100 / 9) * 16,
wwCover=(ww100 / 16) * 9,
solo=0;
if(sidebar_menu.length){
solo=sidebar_menu.height();
}
subtract.each(function(){
wh100_mod -=this.offsetHeight - 1;
});
let whCoverMod=(wh100_mod / 9) * 16;
css +=".avia-section.av-minimum-height .container{opacity: 1; }\n";
css +=".av-minimum-height-100:not(.av-slideshow-section) .container, .avia-fullscreen-slider .avia-slideshow, #top.avia-blank .av-minimum-height-100 .container, .av-cell-min-height-100 > .flex_cell{height: 100vh;}\n";
css +=".av-minimum-height-100vw:not(.av-slideshow-section) .container, #top.avia-blank .av-minimum-height-100vw .container, .av-cell-min-height-100vw > .flex_cell{height: 100vw;}\n";
css +=".av-minimum-height-100.av-slideshow-section .container { height:unset; }\n";
css +=".av-minimum-height-100vw.av-slideshow-section .container { height:unset; }\n";
css +=".av-minimum-height-100.av-slideshow-section {min-height: 100vh;}\n";
css +=".av-minimum-height-100vw.av-slideshow-section {min-height: 100vw;}\n";
$.each(pc_heights, function(index, value){
css +=".av-minimum-height-" + value + ":not(.av-slideshow-section) .container, .av-cell-min-height-" + value + " > .flex_cell	{height:" + value + "vh;}\n";
css +=".av-minimum-height-" + value + ".av-slideshow-section {min-height:" + value + "vh;}\n";
css +=".av-minimum-height-" + value + "vw:not(.av-slideshow-section) .container, .av-cell-min-height-" + value + "vw > .flex_cell	{height:" + value + "vw;}\n";
css +=".av-minimum-height-" + value + "vw.av-slideshow-section {min-height:" + value + "vw;}\n";
});
css +=".avia-builder-el-0.av-minimum-height-100:not(.av-slideshow-section) .container, .avia-builder-el-0.avia-fullscreen-slider .avia-slideshow, .avia-builder-el-0.av-cell-min-height-100 > .flex_cell{height:" + wh100_mod + "px;}\n";
css +="#top .av-solo-full .avia-slideshow {min-height:" + solo + "px;}\n";
if(ww100 / wh100 < 16 / 9){
css +="#top .av-element-cover iframe, #top .av-element-cover embed, #top .av-element-cover object, #top .av-element-cover video{width:" + whCover + "px; left: -" +(whCover - ww100) / 2 + "px;}\n";
}else{
css +="#top .av-element-cover iframe, #top .av-element-cover embed, #top .av-element-cover object, #top .av-element-cover video{height:" + wwCover + "px; top: -"+(wwCover - wh100) / 2 + "px;}\n";
}
if(ww100 / wh100_mod < 16 / 9){
css +="#top .avia-builder-el-0 .av-element-cover iframe, #top .avia-builder-el-0 .av-element-cover embed, #top .avia-builder-el-0 .av-element-cover object, #top .avia-builder-el-0 .av-element-cover video{width:" + whCoverMod + "px; left: -" +(whCoverMod - ww100) / 2 + "px;}\n";
}else{
css +="#top .avia-builder-el-0 .av-element-cover iframe, #top .avia-builder-el-0 .av-element-cover embed, #top .avia-builder-el-0 .av-element-cover object, #top .avia-builder-el-0 .av-element-cover video{height:" + wwCover + "px; top: -" +(wwCover - wh100_mod) / 2 + "px;}\n";
}
try
{
css_block.text(css);
}
catch(err){
css_block.remove();
css_block=$("<style type='text/css' id='av-browser-height'>" + css + "</style>").appendTo(headFirst);
}
setTimeout(function(){
win.trigger('av-height-change'); 
}, 100);
};
this.each(function(index){
let container=$(this),
height=container.data('av_minimum_height_pc');
if('number'!=typeof height){
return this;
}
height=parseInt(height);
if(( -1==$.inArray(height, pc_heights) )&&(height!=100) ){
pc_heights.push(height);
}
return this;
});
win.on('debouncedresize', calc_height);
calc_height();
};
$.fn.avia_container_height=function(){
if(! this.length){
return this;
}
var win=$(window),
calc_height=function(){
var column=$(this),
jsonHeight=column.data('av-column-min-height'),
minHeight=parseInt(jsonHeight['column-min-pc'], 10),
container=null,
containerHeight=0,
columMinHeight=0;
if(isNaN(minHeight)||minHeight==0){
return;
}
container=column.closest('.avia-section');
if(! container.length){
container=column.closest('.av-gridrow-cell');
}
if(! container.length){
container=column.closest('.av-layout-tab');
}
containerHeight=container.length ? container.outerHeight():win.height();
columMinHeight=containerHeight *(minHeight / 100.0);
if(! jsonHeight['column-equal-height']){
column.css('min-height', columMinHeight + 'px');
column.css('height', 'auto');
}else{
column.css('height', columMinHeight + 'px');
}
setTimeout(function(){
win.trigger('av-height-change'); 
}, 100);
};
this.each(function(index){
var column=$(this),
jsonHeight=column.data('av-column-min-height');
if('object'!=typeof jsonHeight){
return this;
}
win.on('debouncedresize', calc_height.bind(column) );
calc_height.call(column);
return this;
});
};
$.fn.avia_video_section=function(){
if(!this.length) return;
var elements=this.length, content="",
win=$(window),
headFirst=$('head').first(),
css_block=$("<style type='text/css' id='av-section-height'></style>").appendTo(headFirst),
calc_height=function(section, counter){
if(counter===0){ content="";}
var css="",
the_id='#' +section.attr('id'),
wh100=section.height(),
ww100=section.width(),
aspect=section.data('sectionVideoRatio').split(':'),
video_w=aspect[0],
video_h=aspect[1],
whCover=(wh100 / video_h) * video_w,
wwCover=(ww100 / video_w) * video_h;
if(ww100/wh100 < video_w/video_h){
css +="#top "+the_id+" .av-section-video-bg iframe, #top "+the_id+" .av-section-video-bg embed, #top "+the_id+" .av-section-video-bg object, #top "+the_id+" .av-section-video-bg video{width:"+whCover+"px; left: -"+(whCover - ww100)/2+"px;}\n";
}else{
css +="#top "+the_id+" .av-section-video-bg iframe, #top "+the_id+" .av-section-video-bg embed, #top "+the_id+" .av-section-video-bg object, #top "+the_id+" .av-section-video-bg video{height:"+wwCover+"px; top: -"+(wwCover - wh100)/2+"px;}\n";
}
content=content + css;
if(elements==counter + 1){
try{
css_block.text(content);
}
catch(err){
css_block.remove();
css_block=$("<style type='text/css' id='av-section-height'>"+content+"</style>").appendTo(headFirst);
}}
};
return this.each(function(i){
var self=$(this);
win.on('debouncedresize', function(){ calc_height(self, i); });
calc_height(self, i);
});
};
$.fn.avia_link_column=function(){
return this.each(function(){
$(this).on('click', function(e){
if('undefined'!==typeof e.target&&'undefined'!==typeof e.target.href){
return;
}
var	column=$(this),
url=column.data('link-column-url'),
target=column.data('link-column-target'),
link=window.location.hostname+window.location.pathname;
if('undefined'===typeof url||'string'!==typeof url){
return;
}
if('undefined'!==typeof target||'_blank'==target){
var a=document.createElement('a');
a.href=url;
a.target='_blank';
a.rel='noopener noreferrer';
a.click();
return false;
}else{
if(column.hasClass('av-cell-link')||column.hasClass('av-column-link')){
var reader=column.hasClass('av-cell-link') ? column.prev('a.av-screen-reader-only').first():column.find('a.av-screen-reader-only').first();
url=url.trim();
if(( 0==url.indexOf("#"))||(( url.indexOf(link) >=0)&&(url.indexOf("#") > 0) )){
reader.trigger('click');
if('undefined'==typeof target||'_blank'!=target){
window.location.href=url;
}
return;
}}
window.location.href=url;
}
e.preventDefault();
return;
});
});
};
$.fn.avia_waypoints=function(options_passed){
if(! $('html').is('.avia_transform')){
return;
}
var defaults={
offset: 'bottom-in-view',
triggerOnce: true
},
options=$.extend({}, defaults, options_passed),
isMobile=$.avia_utilities.isMobile;
return this.each(function(){
var element=$(this),
force_animate=element.hasClass('animate-all-devices'),
mobile_no_animations=$('body').hasClass('avia-mobile-no-animations');
setTimeout(function(){
if(isMobile&&mobile_no_animations&&! force_animate){
element.addClass('avia_start_animation').trigger('avia_start_animation');
}else{
element.waypoint(function(direction){
var current=$(this.element),
parent=current.parents('.av-animation-delay-container').eq(0);
if(parent.length){
current.addClass('avia_start_animation_when_active').trigger('avia_start_animation_when_active');
}
if(! parent.length||(parent.length&&parent.is('.__av_init_open') )||(parent.length&&parent.is('.av-active-tab-content') )){
current.addClass('avia_start_animation').trigger('avia_start_animation');
}}, options);
}}, 100);
});
};
var $event=$.event, $special, resizeTimeout;
$special=$event.special.debouncedresize={
setup: function(){
$(this).on("resize", $special.handler);
},
teardown: function(){
$(this).off("resize", $special.handler);
},
handler: function(event, execAsap){
var context=this,
args=arguments,
dispatch=function(){
event.type="debouncedresize";
$event.dispatch.apply(context, args);
};
if(resizeTimeout){
clearTimeout(resizeTimeout);
}
execAsap ?
dispatch() :
resizeTimeout=setTimeout(dispatch, $special.threshold);
},
threshold: 150
};})(jQuery);
(function($){
"use strict";
$.avia_utilities=$.avia_utilities||{};
$.avia_utilities.loading=function(attach_to, delay){
var loader={
active: false,
show: function(){
if(loader.active===false){
loader.active=true;
loader.loading_item.css({display:'block', opacity:0});
}
loader.loading_item.stop().animate({opacity:1});
},
hide: function(){
if(typeof delay==='undefined'){ delay=600; }
loader.loading_item.stop().delay(delay).animate({opacity:0}, function(){
loader.loading_item.css({display:'none'});
loader.active=false;
});
},
attach: function(){
if(typeof attach_to==='undefined'){ attach_to='body';}
loader.loading_item=$('<div class="avia_loading_icon"><div class="av-siteloader"></div></div>').css({display:"none"}).appendTo(attach_to);
}};
loader.attach();
return loader;
};
$.avia_utilities.playpause=function(attach_to, delay){
var pp={
active: false,
to1: "",
to2: "",
set: function(status){
pp.loading_item.removeClass('av-play av-pause');
pp.to1=setTimeout(function(){ pp.loading_item.addClass('av-' + status); },10);
pp.to2=setTimeout(function(){ pp.loading_item.removeClass('av-' + status); },1500);
},
attach: function(){
if(typeof attach_to==='undefined'){ attach_to='body';}
pp.loading_item=$('<div class="avia_playpause_icon"></div>').css({display:"none"}).appendTo(attach_to);
}};
pp.attach();
return pp;
};
$.avia_utilities.preload=function(options_passed){
new $.AviaPreloader(options_passed);
};
$.AviaPreloader=function(options){
this.win=$(window);
this.defaults	=
{
container:			'body',
maxLoops:			10,
trigger_single:		true,
single_callback:	function(){},
global_callback:	function(){}};
this.options=$.extend({}, this.defaults, options);
this.preload_images=0;
this.load_images();
};
$.AviaPreloader.prototype  =
{
load_images: function(){
var _self=this;
if(typeof _self.options.container==='string'){ _self.options.container=$(_self.options.container); }
_self.options.container.each(function(){
var container=$(this);
container.images=container.find('img');
container.allImages=container.images;
_self.preload_images +=container.images.length;
setTimeout(function(){ _self.checkImage(container); }, 10);
});
},
checkImage: function(container){
var _self=this;
container.images.each(function(){
if(this.complete===true){
container.images=container.images.not(this);
_self.preload_images -=1;
}});
if(container.images.length&&_self.options.maxLoops >=0){
_self.options.maxLoops-=1;
setTimeout(function(){ _self.checkImage(container); }, 500);
}else{
_self.preload_images=_self.preload_images - container.images.length;
_self.trigger_loaded(container);
}},
trigger_loaded: function(container){
var _self=this;
if(_self.options.trigger_single!==false){
_self.win.trigger('avia_images_loaded_single', [container]);
_self.options.single_callback.call(container);
}
if(_self.preload_images===0){
_self.win.trigger('avia_images_loaded');
_self.options.global_callback.call();
}}
};
$.avia_utilities.css_easings={
linear:			'linear',
swing:			'ease-in-out',
bounce:			'cubic-bezier(0.0, 0.35, .5, 1.3)',
easeInQuad:     'cubic-bezier(0.550, 0.085, 0.680, 0.530)' ,
easeInCubic:    'cubic-bezier(0.550, 0.055, 0.675, 0.190)' ,
easeInQuart:    'cubic-bezier(0.895, 0.030, 0.685, 0.220)' ,
easeInQuint:    'cubic-bezier(0.755, 0.050, 0.855, 0.060)' ,
easeInSine:     'cubic-bezier(0.470, 0.000, 0.745, 0.715)' ,
easeInExpo:     'cubic-bezier(0.950, 0.050, 0.795, 0.035)' ,
easeInCirc:     'cubic-bezier(0.600, 0.040, 0.980, 0.335)' ,
easeInBack:     'cubic-bezier(0.600, -0.280, 0.735, 0.04)' ,
easeOutQuad:    'cubic-bezier(0.250, 0.460, 0.450, 0.940)' ,
easeOutCubic:   'cubic-bezier(0.215, 0.610, 0.355, 1.000)' ,
easeOutQuart:   'cubic-bezier(0.165, 0.840, 0.440, 1.000)' ,
easeOutQuint:   'cubic-bezier(0.230, 1.000, 0.320, 1.000)' ,
easeOutSine:    'cubic-bezier(0.390, 0.575, 0.565, 1.000)' ,
easeOutExpo:    'cubic-bezier(0.190, 1.000, 0.220, 1.000)' ,
easeOutCirc:    'cubic-bezier(0.075, 0.820, 0.165, 1.000)' ,
easeOutBack:    'cubic-bezier(0.175, 0.885, 0.320, 1.275)' ,
easeInOutQuad:  'cubic-bezier(0.455, 0.030, 0.515, 0.955)' ,
easeInOutCubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)' ,
easeInOutQuart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)' ,
easeInOutQuint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)' ,
easeInOutSine:  'cubic-bezier(0.445, 0.050, 0.550, 0.950)' ,
easeInOutExpo:  'cubic-bezier(1.000, 0.000, 0.000, 1.000)' ,
easeInOutCirc:  'cubic-bezier(0.785, 0.135, 0.150, 0.860)' ,
easeInOutBack:  'cubic-bezier(0.680, -0.550, 0.265, 1.55)' ,
easeInOutBounce:'cubic-bezier(0.580, -0.365, 0.490, 1.365)',
easeOutBounce:	'cubic-bezier(0.760, 0.085, 0.490, 1.365)'
};
$.avia_utilities.supported={};
$.avia_utilities.supports=(function(){
var div=document.createElement('div'),
vendors=['Khtml', 'Ms','Moz','Webkit'];
return function(prop, vendor_overwrite){
if(div.style[prop]!==undefined){ return ""; }
if(vendor_overwrite!==undefined){ vendors=vendor_overwrite; }
prop=prop.replace(/^[a-z]/, function(val){
return val.toUpperCase();
});
var len=vendors.length;
while(len--){
if(div.style[vendors[len] + prop]!==undefined){
return "-" + vendors[len].toLowerCase() + "-";
}}
return false;
};}());
$.fn.avia_animate=function(prop, speed, easing, callback){
if(typeof speed==='function'){callback=speed; speed=false; }
if(typeof easing==='function'){callback=easing; easing=false;}
if(typeof speed==='string'){easing=speed; speed=false;}
if(callback===undefined||callback===false){ callback=function(){};}
if(easing===undefined||easing===false){ easing='easeInQuad'; }
if(speed===undefined||speed===false){ speed=400; }
if($.avia_utilities.supported.transition===undefined){
$.avia_utilities.supported.transition=$.avia_utilities.supports('transition');
}
if($.avia_utilities.supported.transition!==false){
var prefix=$.avia_utilities.supported.transition + 'transition',
cssRule={},
cssProp={},
thisStyle=document.body.style,
end=(thisStyle.WebkitTransition!==undefined) ? 'webkitTransitionEnd':(thisStyle.OTransition!==undefined) ? 'oTransitionEnd':'transitionend';
easing=$.avia_utilities.css_easings[easing];
cssRule[prefix]='all '+(speed/1000)+'s '+easing;
end=end + ".avia_animate";
for (var rule in prop){
if(prop.hasOwnProperty(rule)){ cssProp[rule]=prop[rule]; }}
prop=cssProp;
this.each(function(){
var element=$(this), css_difference=false, rule, current_css;
for (rule in prop){
if(prop.hasOwnProperty(rule)){
current_css=element.css(rule);
if(prop[rule]!=current_css&&prop[rule]!=current_css.replace(/px|%/g,"")){
css_difference=true;
break;
}}
}
if(css_difference){
if(!($.avia_utilities.supported.transition+"transform" in prop)){
prop[$.avia_utilities.supported.transition+"transform"]="translateZ(0)";
}
var endTriggered=false;
element.on(end,  function(event){
if(event.target!=event.currentTarget) return false;
if(endTriggered==true) return false;
endTriggered=true;
cssRule[prefix]="none";
element.off(end);
element.css(cssRule);
setTimeout(function(){ callback.call(element); });
});
setTimeout(function(){
if(!endTriggered&&!avia_is_mobile&&$('html').is('.avia-safari')){
element.trigger(end);
$.avia_utilities.log('Safari Fallback '+end+' trigger');
}}, speed + 100);
setTimeout(function(){ element.css(cssRule);},10);
setTimeout(function(){ element.css(prop);	},20);
}else{
setTimeout(function(){ callback.call(element); });
}});
}else{
this.animate(prop, speed, easing, callback);
}
return this;
};})(jQuery);
(function($){
"use strict";
$.fn.avia_keyboard_controls=function(options_passed){
var defaults	=
{
37: '.prev-slide',
39: '.next-slide'
},
methods={
mousebind: function(slider){
slider.on('mouseenter', function(){
slider.mouseover=true;  })
.on('mouseleave', function(){
slider.mouseover=false; }
);
},
keybind: function(slider){
$(document).on('keydown', function(e){
if(slider.mouseover&&typeof slider.options[e.keyCode]!=='undefined'){
var item;
if(typeof slider.options[e.keyCode]==='string'){
item=slider.find(slider.options[e.keyCode]);
}else{
item=slider.options[e.keyCode];
}
if(item.length){
item.trigger('click', ['keypress']);
return false;
}}
});
}};
return this.each(function(){
var slider=$(this);
slider.options=$.extend({}, defaults, options_passed);
slider.mouseover=false;
methods.mousebind(slider);
methods.keybind(slider);
});
};
$.fn.avia_swipe_trigger=function(passed_options){
var win=$(window),
isMobile=$.avia_utilities.isMobile,
isTouchDevice=$.avia_utilities.isTouchDevice,
body=$('body'),
defaults =
{
prev: '.prev-slide',
next: '.next-slide',
delay_trigger: false,
event: {
prev: 'click',
next: 'click'
},
beforeTrigger: null,
afterTrigger: null,
afterDelayedTrigger: null
},
methods =
{
activate_touch_control: function(slider){
var i,
differenceX,
differenceY;
slider.touchPos={};
slider.hasMoved=false;
slider.on('touchstart', function(event){
slider.touchPos.X=event.originalEvent.touches[0].clientX;
slider.touchPos.Y=event.originalEvent.touches[0].clientY;
});
slider.on('touchend', function(event){
slider.touchPos={};
if(slider.hasMoved){
event.preventDefault();
}
slider.hasMoved=false;
});
slider.on('touchmove', function(event){
if(body.hasClass('avia-swipe-executed') ){
return;
}
if(! slider.touchPos.X){
slider.touchPos.X=event.originalEvent.touches[0].clientX;
slider.touchPos.Y=event.originalEvent.touches[0].clientY;
}else{
differenceX=event.originalEvent.touches[0].clientX - slider.touchPos.X;
differenceY=event.originalEvent.touches[0].clientY - slider.touchPos.Y;
if(Math.abs(differenceX) > Math.abs(differenceY) ){
if(slider.touchPos!==event.originalEvent.touches[0].clientX){
if(Math.abs(differenceX) > 50){
i=differenceX > 0 ? 'prev':'next';
let element=slider.options[i];
if(element==null){
return;
}
if(typeof slider.options.beforeTrigger=='function'){
slider.options.beforeTrigger(slider, i);
}
if(typeof slider.options[i]==='string'){
slider.find(slider.options[i]).trigger(slider.options.event[i], ['swipe']);
}else{
if(typeof element.jquery=='string'){
element.trigger(slider.options.event[i], ['swipe']);
}else{
let action=slider.options.event[i];
if(action.indexOf('native_') < 0){
element.dispatchEvent(new Event(action) );
}else{
let func_action=action.replace('native_', '');
if(typeof element[ func_action ]=='function'){
if(slider.options.delay_trigger){
setTimeout(function(){
element[ func_action ]();
if(typeof slider.options.afterDelayedTrigger=='function'){
slider.options.afterDelayedTrigger(slider, i);
}}, 50);
}else{
element[ func_action ]();
}}else{
element.dispatchEvent(new Event(action) );
}}
}}
if(typeof slider.options.afterTrigger=='function'){
slider.options.afterTrigger(slider, i);
}
event.preventDefault();
event.stopImmediatePropagation();
body.addClass('avia-swipe-executed');
setTimeout(function(){
body.removeClass('avia-swipe-executed');
}, 300);
slider.hasMoved=true;
slider.touchPos={};
return false;
}}
}}
});
}};
return this.each(function(){
if(isMobile||isTouchDevice){
var slider=$(this);
slider.options=$.extend({}, defaults, passed_options);
methods.activate_touch_control(slider);
}});
};}(jQuery));
(function($){
if(typeof $.easing!=='undefined'){
$.easing['jswing']=$.easing['swing'];
}
var pow=Math.pow,
sqrt=Math.sqrt,
sin=Math.sin,
cos=Math.cos,
PI=Math.PI,
c1=1.70158,
c2=c1 * 1.525,
c3=c1 + 1,
c4=(2 * PI) / 3,
c5=(2 * PI) / 4.5;
function bounceOut(x){
var n1=7.5625,
d1=2.75;
if(x < 1/d1){
return n1*x*x;
}else if(x < 2/d1){
return n1*(x-=(1.5/d1))*x + .75;
}else if(x < 2.5/d1){
return n1*(x-=(2.25/d1))*x + .9375;
}else{
return n1*(x-=(2.625/d1))*x + .984375;
}}
$.extend($.easing,
{
def: 'easeOutQuad',
swing: function (x){
return $.easing[$.easing.def](x);
},
easeInQuad: function (x){
return x * x;
},
easeOutQuad: function (x){
return 1 -(1 - x) *(1 - x);
},
easeInOutQuad: function (x){
return x < 0.5 ?
2 * x * x :
1 - pow(-2 * x + 2, 2) / 2;
},
easeInCubic: function (x){
return x * x * x;
},
easeOutCubic: function (x){
return 1 - pow(1 - x, 3);
},
easeInOutCubic: function (x){
return x < 0.5 ?
4 * x * x * x :
1 - pow(-2 * x + 2, 3) / 2;
},
easeInQuart: function (x){
return x * x * x * x;
},
easeOutQuart: function (x){
return 1 - pow(1 - x, 4);
},
easeInOutQuart: function (x){
return x < 0.5 ?
8 * x * x * x * x :
1 - pow(-2 * x + 2, 4) / 2;
},
easeInQuint: function (x){
return x * x * x * x * x;
},
easeOutQuint: function (x){
return 1 - pow(1 - x, 5);
},
easeInOutQuint: function (x){
return x < 0.5 ?
16 * x * x * x * x * x :
1 - pow(-2 * x + 2, 5) / 2;
},
easeInSine: function (x){
return 1 - cos(x * PI/2);
},
easeOutSine: function (x){
return sin(x * PI/2);
},
easeInOutSine: function (x){
return -(cos(PI * x) - 1) / 2;
},
easeInExpo: function (x){
return x===0 ? 0:pow(2, 10 * x - 10);
},
easeOutExpo: function (x){
return x===1 ? 1:1 - pow(2, -10 * x);
},
easeInOutExpo: function (x){
return x===0 ? 0:x===1 ? 1:x < 0.5 ?
pow(2, 20 * x - 10) / 2 :
(2 - pow(2, -20 * x + 10) ) / 2;
},
easeInCirc: function (x){
return 1 - sqrt(1 - pow(x, 2) );
},
easeOutCirc: function (x){
return sqrt(1 - pow(x - 1, 2) );
},
easeInOutCirc: function (x){
return x < 0.5 ?
(1 - sqrt(1 - pow(2 * x, 2) )) / 2 :
(sqrt(1 - pow(-2 * x + 2, 2) ) + 1) / 2;
},
easeInElastic: function (x){
return x===0 ? 0:x===1 ? 1 :
-pow(2, 10 * x - 10) * sin(( x * 10 - 10.75) * c4);
},
easeOutElastic: function (x){
return x===0 ? 0:x===1 ? 1 :
pow(2, -10 * x) * sin(( x * 10 - 0.75) * c4) + 1;
},
easeInOutElastic: function (x){
return x===0 ? 0:x===1 ? 1:x < 0.5 ?
-(pow(2, 20 * x - 10) * sin(( 20 * x - 11.125) * c5)) / 2 :
pow(2, -20 * x + 10) * sin(( 20 * x - 11.125) * c5) / 2 + 1;
},
easeInBack: function (x){
return c3 * x * x * x - c1 * x * x;
},
easeOutBack: function (x){
return 1 + c3 * pow(x - 1, 3) + c1 * pow(x - 1, 2);
},
easeInOutBack: function (x){
return x < 0.5 ?
(pow(2 * x, 2) *(( c2 + 1) * 2 * x - c2) ) / 2 :
(pow(2 * x - 2, 2) *(( c2 + 1) *(x * 2 - 2) + c2) + 2) / 2;
},
easeInBounce: function (x){
return 1 - bounceOut(1 - x);
},
easeOutBounce: bounceOut,
easeInOutBounce: function (x){
return x < 0.5 ?
(1 - bounceOut(1 - 2 * x) ) / 2 :
(1 + bounceOut(2 * x - 1) ) / 2;
}});
}(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);