').insertBefore($active_carousel_group);
$prev_carousel_group.css({ 'left': '-' + $active_carousel_group.innerWidth(), 'width': $active_carousel_group.innerWidth() }).show();
for(x=(items.length - 1), total=(items.length - 1) ; ; x--, total--){
if(total <=active_items_start&&total >=active_items_end){
$(items[x]).addClass('changing_position current_position current_position_' + current_position);
$(items[x]).data('current_position', current_position);
current_position--;
}
if(total <=prev_items_start&&total >=prev_items_end){
$(items[x]).data('prev_position', prev_position);
$(items[x]).addClass('changing_position prev_position prev_position_' + prev_position);
if(!$(items[x]).hasClass('current_position')){
$(items[x]).addClass('container_append');
}else{
$(items[x]).clone(true).appendTo($active_carousel_group).addClass('delayed_container_append_dup').attr('id', $(items[x]).attr('id') + '-dup');
$(items[x]).addClass('delayed_container_append');
}
prev_position--;
}
if(prev_position <=0){
break;
}
if(x==0){
x=items.length;
}}
sorted=$portfolio_items.find('.container_append, .delayed_container_append_dup').sort(function (a, b){
var el_a_position=parseInt($(a).data('prev_position'));
var el_b_position=parseInt($(b).data('prev_position'));
return(el_a_position < el_b_position) ? -1:(el_a_position > el_b_position) ? 1:0;
});
$(sorted).show().appendTo($prev_carousel_group);
$prev_carousel_group.children().each(function(){
$(this).css({'width': item_width, 'position':'absolute', 'left':(item_width *($(this).data('prev_position') - 1)) });
});
$active_carousel_group.animate({
left: '100%'
}, {
duration: slide_duration,
complete: function(){
$portfolio_items.find('.delayed_container_append').reverse().each(function(){
$(this).css({'width': item_width, 'position':'absolute', 'left':(item_width *($(this).data('prev_position') - 1)) });
$(this).prependTo($prev_carousel_group);
});
$active_carousel_group.removeClass('active');
$active_carousel_group.children().each(function(){
position=$(this).data('position');
current_position=$(this).data('current_position');
$(this).removeClass('position_' + position + ' ' + 'changing_position current_position current_position_' + current_position);
$(this).data('position', '');
$(this).data('current_position', '');
$(this).hide();
$(this).css({'position': '', 'width': '', 'left': ''});
$(this).appendTo($portfolio_items);
});
$active_carousel_group.remove();
}});
$prev_carousel_group.addClass('active').css({'position':'absolute', 'top':0, left: '-100%'});
$prev_carousel_group.animate({
left: '0%'
}, {
duration: slide_duration,
complete: function(){
setTimeout(function(){
$prev_carousel_group.removeClass('prev').addClass('active').css({'position':'', 'width':'', 'top':'', 'left': ''});
$prev_carousel_group.find('.delayed_container_append_dup').remove();
$prev_carousel_group.find('.changing_position').each(function(index){
position=$(this).data('position');
current_position=$(this).data('current_position');
prev_position=$(this).data('prev_position');
$(this).removeClass('container_append delayed_container_append position_' + position + ' ' + 'changing_position current_position current_position_' + current_position + ' prev_position prev_position_' + prev_position);
$(this).data('current_position', '');
$(this).data('prev_position', '');
position=index + 1;
$(this).data('position', position);
$(this).addClass('position_' + position);
});
$prev_carousel_group.children().css({'position': '', 'width': original_item_width, 'left': ''});
$the_portfolio.data('carouseling', false);
}, 100);
}});
}}
function set_fullwidth_portfolio_columns($the_portfolio, carousel_mode){
var columns,
$portfolio_items=$the_portfolio.find('.et_pb_portfolio_items'),
portfolio_items_width=$portfolio_items.width(),
$the_portfolio_items=$portfolio_items.find('.et_pb_portfolio_item'),
portfolio_item_count=$the_portfolio_items.length;
if('undefined'===typeof $the_portfolio_items){
return;
}
if(portfolio_items_width >=1600){
columns=5;
}else if(portfolio_items_width >=1024){
columns=4;
}else if(portfolio_items_width >=768){
columns=3;
}else if(portfolio_items_width >=480){
columns=2;
}else{
columns=1;
}
portfolio_item_width=portfolio_items_width / columns;
portfolio_item_height=portfolio_item_width * .75;
if(carousel_mode){
$portfolio_items.css({ 'height':portfolio_item_height });
}
$the_portfolio_items.css({ 'height':portfolio_item_height });
if(columns===$portfolio_items.data('portfolio-columns')){
return;
}
if($the_portfolio.data('columns_setting_up')){
return;
}
$the_portfolio.data('columns_setting_up', true);
var portfolio_item_width_percentage=(100 / columns) + '%';
$the_portfolio_items.css({ 'width':portfolio_item_width_percentage });
$portfolio_items.removeClass('columns-' + $portfolio_items.data('portfolio-columns'));
$portfolio_items.addClass('columns-' + columns);
$portfolio_items.data('portfolio-columns', columns);
if(!carousel_mode){
return $the_portfolio.data('columns_setting_up', false);
}
if($portfolio_items.find('.et_pb_carousel_group').length){
$the_portfolio_items.appendTo($portfolio_items);
$portfolio_items.find('.et_pb_carousel_group').remove();
}
var the_portfolio_items=$portfolio_items.data('items'),
$carousel_group=$('
').appendTo($portfolio_items);
if('undefined'===typeof the_portfolio_items){
return;
}
$the_portfolio_items.data('position', '');
if(the_portfolio_items.length <=columns){
$portfolio_items.find('.et-pb-slider-arrows').hide();
}else{
$portfolio_items.find('.et-pb-slider-arrows').show();
}
for(position=1, x=0 ;x < the_portfolio_items.length; x++, position++){
if(x < columns){
$(the_portfolio_items[x]).show();
$(the_portfolio_items[x]).appendTo($carousel_group);
$(the_portfolio_items[x]).data('position', position);
$(the_portfolio_items[x]).addClass('position_' + position);
}else{
position=$(the_portfolio_items[x]).data('position');
$(the_portfolio_items[x]).removeClass('position_' + position);
$(the_portfolio_items[x]).data('position', '');
$(the_portfolio_items[x]).hide();
}}
$the_portfolio.data('columns_setting_up', false);
}
function et_carousel_auto_rotate($carousel){
if('on'===$carousel.data('auto-rotate')&&$carousel.find('.et_pb_portfolio_item').length > $carousel.find('.et_pb_carousel_group .et_pb_portfolio_item').length&&! $carousel.hasClass('et_carousel_hovered')){
et_carousel_timer=setTimeout(function(){
fullwidth_portfolio_carousel_slide($carousel.find('.et-pb-arrow-next'));
}, $carousel.data('auto-rotate-speed'));
$carousel.data('et_carousel_timer', et_carousel_timer);
}}
$et_pb_fullwidth_portfolio.each(function(){
et_fullwidth_portfolio_init($(this));
});
}
function et_audio_module_set(){
if($('.et_pb_audio_module .mejs-audio').length||$('.et_audio_content .mejs-audio').length){
$('.et_audio_container').each(function(){
et_pb_audio_module_init($(this));
});
}}
window.et_pb_audio_module_init=function($audio_container){
var $this_player=$audio_container,
$time_rail=$this_player.find('.mejs-time-rail'),
$time_slider=$this_player.find('.mejs-time-slider');
$time_rail.removeAttr('style');
$time_slider.removeAttr('style');
var $count_timer=$this_player.find('div.mejs-currenttime-container'),
$count_timer_width_container=$this_player.find('.mejs-duration-container').length ? $this_player.find('.mejs-duration-container'):$this_player.find('.mejs-currenttime-container'),
player_width=$this_player.width(),
controls_play_width=$this_player.find('.mejs-play').outerWidth(),
time_width=$count_timer_width_container.outerWidth(),
volume_icon_width=$this_player.find('.mejs-volume-button').outerWidth(),
volume_bar_width=$this_player.find('.mejs-horizontal-volume-slider').outerWidth(),
new_time_rail_width;
$count_timer.addClass('custom');
$this_player.find('.mejs-controls div.mejs-duration-container').replaceWith($count_timer);
new_time_rail_width=player_width -(controls_play_width + time_width + volume_icon_width + volume_bar_width + 65);
if(0 < new_time_rail_width){
$time_rail.attr('style', 'min-width: ' + new_time_rail_width + 'px;');
$time_slider.attr('style', 'min-width: ' + new_time_rail_width + 'px;');
}}
if($('.et_pb_section_video').length){
window._wpmejsSettings.pauseOtherPlayers=false;
}
if($et_pb_filterable_portfolio.length||is_frontend_builder){
window.et_pb_filterable_portfolio_init=function($selector){
if(typeof $selector!=='undefined'){
set_filterable_portfolio_init($selector);
}else{
$et_pb_filterable_portfolio.each(function(){
set_filterable_portfolio_init($(this))
});
}}
window.set_filterable_portfolio_init=function($the_portfolio){
var $the_portfolio_items=$the_portfolio.find('.et_pb_portfolio_items'),
$left_orientatation=true==$the_portfolio.data('rtl') ? false:true;
$the_portfolio.show();
set_filterable_grid_items($the_portfolio);
$the_portfolio.on('click', '.et_pb_portfolio_filter a', function(e){
e.preventDefault();
var category_slug=$(this).data('category-slug');
$the_portfolio_items=$(this).parents('.et_pb_filterable_portfolio').find('.et_pb_portfolio_items');
if('all'==category_slug){
$the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active');
$the_portfolio.find('.et_pb_portfolio_filter_all a').addClass('active');
$the_portfolio.find('.et_pb_portfolio_item').removeClass('active inactive');
$the_portfolio.find('.et_pb_portfolio_item').show();
$the_portfolio.find('.et_pb_portfolio_item').addClass('active');
}else{
$the_portfolio.find('.et_pb_portfolio_filter_all').removeClass('active');
$the_portfolio.find('.et_pb_portfolio_filter a').removeClass('active');
$the_portfolio.find('.et_pb_portfolio_filter_all a').removeClass('active');
$(this).addClass('active');
$the_portfolio_items.find('.et_pb_portfolio_item').hide();
$the_portfolio_items.find('.et_pb_portfolio_item').addClass('inactive');
$the_portfolio_items.find('.et_pb_portfolio_item').removeClass('active');
$the_portfolio_items.find('.et_pb_portfolio_item.project_category_' + $(this).data('category-slug')).show();
$the_portfolio_items.find('.et_pb_portfolio_item.project_category_' + $(this).data('category-slug')).addClass('active').removeClass('inactive');
}
set_filterable_grid_items($the_portfolio);
setTimeout(function(){
set_filterable_portfolio_hash($the_portfolio);
}, 500);
});
$the_portfolio.on('click', '.et_pb_portofolio_pagination a', function(e){
e.preventDefault();
var to_page=$(this).data('page'),
$the_portfolio=$(this).parents('.et_pb_filterable_portfolio'),
$the_portfolio_items=$the_portfolio.find('.et_pb_portfolio_items');
et_pb_smooth_scroll($the_portfolio, false, 800);
if($(this).hasClass('page-prev')){
to_page=parseInt($(this).parents('ul').find('a.active').data('page')) - 1;
}else if($(this).hasClass('page-next')){
to_page=parseInt($(this).parents('ul').find('a.active').data('page')) + 1;
}
$(this).parents('ul').find('a').removeClass('active');
$(this).parents('ul').find('a.page-' + to_page).addClass('active');
var current_index=$(this).parents('ul').find('a.page-' + to_page).parent().index(),
total_pages=$(this).parents('ul').find('li.page').length;
$(this).parent().nextUntil('.page-' +(current_index + 3)).show();
$(this).parent().prevUntil('.page-' +(current_index - 3)).show();
$(this).parents('ul').find('li.page').each(function(i){
if(!$(this).hasClass('prev')&&!$(this).hasClass('next')){
if(i <(current_index - 3)){
$(this).hide();
}else if(i >(current_index + 1)){
$(this).hide();
}else{
$(this).show();
}
if(total_pages - current_index <=2&&total_pages - i <=5){
$(this).show();
}else if(current_index <=3&&i <=4){
$(this).show();
}}
});
if(to_page > 1){
$(this).parents('ul').find('li.prev').show();
}else{
$(this).parents('ul').find('li.prev').hide();
}
if($(this).parents('ul').find('a.active').hasClass('last-page')){
$(this).parents('ul').find('li.next').hide();
}else{
$(this).parents('ul').find('li.next').show();
}
$the_portfolio.find('.et_pb_portfolio_item').hide();
$the_portfolio.find('.et_pb_portfolio_item').filter(function(index){
return $(this).data('page')===to_page;
}).show();
setTimeout(function(){
set_filterable_portfolio_hash($the_portfolio);
}, 500);
});
$(this).on('et_hashchange', function(event){
var params=event.params;
$the_portfolio=$('#' + event.target.id);
if(!$the_portfolio.find('.et_pb_portfolio_filter a[data-category-slug="' + params[0] + '"]').hasClass('active')){
$the_portfolio.find('.et_pb_portfolio_filter a[data-category-slug="' + params[0] + '"]').click();
}
if(params[1]){
setTimeout(function(){
if(!$the_portfolio.find('.et_pb_portofolio_pagination a.page-' + params[1]).hasClass('active')){
$the_portfolio.find('.et_pb_portofolio_pagination a.page-' + params[1]).addClass('active').click();
}}, 300);
}});
}
if(window.et_load_event_fired){
et_pb_filterable_portfolio_init();
}else{
$(window).load(function(){
et_pb_filterable_portfolio_init();
});
}
function set_filterable_grid_items($the_portfolio){
var active_category=$the_portfolio.find('.et_pb_portfolio_filter > a.active').data('category-slug');
window.et_pb_set_responsive_grid($the_portfolio.find('.et_pb_portfolio_items'), '.et_pb_portfolio_item');
if('all'===active_category){
$the_portfolio_visible_items=$the_portfolio.find('.et_pb_portfolio_item');
}else{
$the_portfolio_visible_items=$the_portfolio.find('.et_pb_portfolio_item.project_category_' + active_category);
}
var visible_grid_items=$the_portfolio_visible_items.length,
posts_number=$the_portfolio.data('posts-number'),
pages=0===posts_number ? 1:Math.ceil(visible_grid_items / posts_number);
set_filterable_grid_pages($the_portfolio, pages);
var visible_grid_items=0;
var _page=1;
$the_portfolio.find('.et_pb_portfolio_item').data('page', '');
$the_portfolio_visible_items.each(function(i){
visible_grid_items++;
if(0===parseInt(visible_grid_items % posts_number)){
$(this).data('page', _page);
_page++;
}else{
$(this).data('page', _page);
}});
$the_portfolio_visible_items.filter(function(){
return $(this).data('page')==1;
}).show();
$the_portfolio_visible_items.filter(function(){
return $(this).data('page')!=1;
}).hide();
}
function set_filterable_grid_pages($the_portfolio, pages){
$pagination=$the_portfolio.find('.et_pb_portofolio_pagination');
if(!$pagination.length){
return;
}
$pagination.html('
');
if(pages <=1){
return;
}
$pagination_list=$pagination.children('ul');
$pagination_list.append('
' + et_pb_custom.prev + '');
for(var page=1; page <=pages; page++){
var first_page_class=page===1 ? ' active':'',
last_page_class=page===pages ? ' last-page':'',
hidden_page_class=page >=5 ? ' style="display:none;"':'';
$pagination_list.append('
' + page + '');
}
$pagination_list.append('
' + et_pb_custom.next + '');
}
function set_filterable_portfolio_hash($the_portfolio){
if(!$the_portfolio.attr('id')){
return;
}
var this_portfolio_state=[];
this_portfolio_state.push($the_portfolio.attr('id'));
this_portfolio_state.push($the_portfolio.find('.et_pb_portfolio_filter > a.active').data('category-slug'));
if($the_portfolio.find('.et_pb_portofolio_pagination a.active').length){
this_portfolio_state.push($the_portfolio.find('.et_pb_portofolio_pagination a.active').data('page'));
}else{
this_portfolio_state.push(1);
}
this_portfolio_state=this_portfolio_state.join(et_hash_module_param_seperator);
et_set_hash(this_portfolio_state);
}}
if($et_pb_gallery.length||is_frontend_builder){
window.set_gallery_grid_items=function($the_gallery){
var $the_gallery_items_container=$the_gallery.find('.et_pb_gallery_items'),
$the_gallery_items=$the_gallery_items_container.find('.et_pb_gallery_item');
var total_grid_items=$the_gallery_items.length,
posts_number_original=parseInt($the_gallery_items_container.attr('data-per_page')),
posts_number=isNaN(posts_number_original)||0===posts_number_original ? 4:posts_number_original,
pages=Math.ceil(total_grid_items / posts_number);
set_gallery_grid_pages($the_gallery, pages);
var total_grid_items=0;
var _page=1;
$the_gallery_items.data('page', '');
$the_gallery_items.each(function(i){
total_grid_items++;
if(0===parseInt(total_grid_items % posts_number)){
$(this).data('page', _page);
_page++;
}else{
$(this).data('page', _page);
}});
var visible_items=$the_gallery_items.filter(function(){
return $(this).data('page')==1;
}).show();
$the_gallery_items.filter(function(){
return $(this).data('page')!=1;
}).hide();
}
window.set_gallery_grid_pages=function($the_gallery, pages){
$pagination=$the_gallery.find('.et_pb_gallery_pagination');
if(!$pagination.length){
return;
}
$pagination.html('
');
if(pages <=1){
$pagination.hide();
return;
}
$pagination_list=$pagination.children('ul');
$pagination_list.append('
' + et_pb_custom.prev + '');
for(var page=1; page <=pages; page++){
var first_page_class=page===1 ? ' active':'',
last_page_class=page===pages ? ' last-page':'',
hidden_page_class=page >=5 ? ' style="display:none;"':'';
$pagination_list.append('
' + page + '');
}
$pagination_list.append('
' + et_pb_custom.next + '');
}
window.set_gallery_hash=function($the_gallery){
if(!$the_gallery.attr('id')){
return;
}
var this_gallery_state=[];
this_gallery_state.push($the_gallery.attr('id'));
if($the_gallery.find('.et_pb_gallery_pagination a.active').length){
this_gallery_state.push($the_gallery.find('.et_pb_gallery_pagination a.active').data('page'));
}else{
this_gallery_state.push(1);
}
this_gallery_state=this_gallery_state.join(et_hash_module_param_seperator);
et_set_hash(this_gallery_state);
}
window.et_pb_gallery_init=function($the_gallery){
if($the_gallery.hasClass('et_pb_gallery_grid')){
$the_gallery.show();
set_gallery_grid_items($the_gallery);
$the_gallery.on('et_hashchange', function(event){
var params=event.params;
$the_gallery=$('#' + event.target.id);
if(page_to=params[0]){
if(!$the_gallery.find('.et_pb_gallery_pagination a.page-' + page_to).hasClass('active')){
$the_gallery.find('.et_pb_gallery_pagination a.page-' + page_to).addClass('active').click();
}}
});
}}
$et_pb_gallery.each(function(){
var $the_gallery=$(this);
et_pb_gallery_init($the_gallery);
});
$et_pb_gallery.data('paginating', false);
window.et_pb_gallery_pagination_nav=function($the_gallery){
$the_gallery.on('click', '.et_pb_gallery_pagination a', function(e){
e.preventDefault();
var to_page=$(this).data('page'),
$the_gallery=$(this).parents('.et_pb_gallery'),
$the_gallery_items_container=$the_gallery.find('.et_pb_gallery_items'),
$the_gallery_items=$the_gallery_items_container.find('.et_pb_gallery_item');
if($the_gallery.data('paginating')){
return;
}
$the_gallery.data('paginating', true);
if($(this).hasClass('page-prev')){
to_page=parseInt($(this).parents('ul').find('a.active').data('page')) - 1;
}else if($(this).hasClass('page-next')){
to_page=parseInt($(this).parents('ul').find('a.active').data('page')) + 1;
}
$(this).parents('ul').find('a').removeClass('active');
$(this).parents('ul').find('a.page-' + to_page).addClass('active');
var current_index=$(this).parents('ul').find('a.page-' + to_page).parent().index(),
total_pages=$(this).parents('ul').find('li.page').length;
$(this).parent().nextUntil('.page-' +(current_index + 3)).show();
$(this).parent().prevUntil('.page-' +(current_index - 3)).show();
$(this).parents('ul').find('li.page').each(function(i){
if(!$(this).hasClass('prev')&&!$(this).hasClass('next')){
if(i <(current_index - 3)){
$(this).hide();
}else if(i >(current_index + 1)){
$(this).hide();
}else{
$(this).show();
}
if(total_pages - current_index <=2&&total_pages - i <=5){
$(this).show();
}else if(current_index <=3&&i <=4){
$(this).show();
}}
});
if(to_page > 1){
$(this).parents('ul').find('li.prev').show();
}else{
$(this).parents('ul').find('li.prev').hide();
}
if($(this).parents('ul').find('a.active').hasClass('last-page')){
$(this).parents('ul').find('li.next').hide();
}else{
$(this).parents('ul').find('li.next').show();
}
$the_gallery_items.hide();
var visible_items=$the_gallery_items.filter(function(index){
return $(this).data('page')===to_page;
}).show();
$the_gallery.data('paginating', false);
window.et_pb_set_responsive_grid($the_gallery_items_container, '.et_pb_gallery_item');
setTimeout(function(){
set_gallery_hash($the_gallery);
}, 100);
$('html, body').animate({ scrollTop:$the_gallery.offset().top - 200 }, 200);
});
}
et_pb_gallery_pagination_nav($et_pb_gallery);
if(is_frontend_builder){
et_pb_gallery_pagination_nav($('#et-fb-app'));
}}
if($et_pb_counter_amount.length){
$et_pb_counter_amount.each(function(){
window.et_bar_counters_init($(this));
});
}
window.et_countdown_timer=function(timer){
var end_date=parseInt(timer.attr('data-end-timestamp')),
current_date=new Date().getTime() / 1000,
seconds_left=(end_date - current_date);
days=parseInt(seconds_left / 86400);
days=days > 0 ? days:0;
seconds_left=seconds_left % 86400;
hours=parseInt(seconds_left / 3600);
hours=hours > 0 ? hours:0;
seconds_left=seconds_left % 3600;
minutes=parseInt(seconds_left / 60);
minutes=minutes > 0 ? minutes:0;
seconds=parseInt(seconds_left % 60);
seconds=seconds > 0 ? seconds:0;
var $days_section=timer.find('.days > .value').parent('.section'),
$hours_section=timer.find('.hours > .value').parent('.section'),
$minutes_section=timer.find('.minutes > .value').parent('.section'),
$seconds_section=timer.find('.seconds > .value').parent('.section');
if(days==0){
if(! $days_section.hasClass('zero')){
timer.find('.days > .value').html('000').parent('.section').addClass('zero').next().addClass('zero');
}}else{
days_slice=days.toString().length >=3 ? days.toString().length:3;
timer.find('.days > .value').html(('000' + days).slice(-days_slice));
if($days_section.hasClass('zero')){
$days_section.removeClass('zero').next().removeClass('zero');
}}
if(days==0&&hours==0){
if(! $hours_section.hasClass('zero')){
timer.find('.hours > .value').html('00').parent('.section').addClass('zero').next().addClass('zero');
}}else{
timer.find('.hours > .value').html(( '0' + hours).slice(-2));
if($hours_section.hasClass('zero')){
$hours_section.removeClass('zero').next().removeClass('zero');
}}
if(days==0&&hours==0&&minutes==0){
if(! $minutes_section.hasClass('zero')){
timer.find('.minutes > .value').html('00').parent('.section').addClass('zero').next().addClass('zero');
}}else{
timer.find('.minutes > .value').html(( '0' + minutes).slice(-2));
if($minutes_section.hasClass('zero')){
$minutes_section.removeClass('zero').next().removeClass('zero');
}}
if(days==0&&hours==0&&minutes==0&&seconds==0){
if(! $seconds_section.hasClass('zero')){
timer.find('.seconds > .value').html('00').parent('.section').addClass('zero');
}}else{
timer.find('.seconds > .value').html(( '0' + seconds).slice(-2));
if($seconds_section.hasClass('zero')){
$seconds_section.removeClass('zero').next().removeClass('zero');
}}
}
window.et_countdown_timer_labels=function(timer){
if(timer.closest('.et_pb_column_3_8').length||timer.closest('.et_pb_column_1_4').length||timer.children('.et_pb_countdown_timer_container').width() <=400){
timer.find('.days .label').html(timer.find('.days').data('short'));
timer.find('.hours .label').html(timer.find('.hours').data('short'));
timer.find('.minutes .label').html(timer.find('.minutes').data('short'));
timer.find('.seconds .label').html(timer.find('.seconds').data('short'));
}else{
timer.find('.days .label').html(timer.find('.days').data('full'));
timer.find('.hours .label').html(timer.find('.hours').data('full'));
timer.find('.minutes .label').html(timer.find('.minutes').data('full'));
timer.find('.seconds .label').html(timer.find('.seconds').data('full'));
}}
if($et_pb_countdown_timer.length||is_frontend_builder){
window.et_pb_countdown_timer_init=function($et_pb_countdown_timer){
$et_pb_countdown_timer.each(function(){
var timer=$(this);
et_countdown_timer_labels(timer);
et_countdown_timer(timer);
setInterval(function(){
et_countdown_timer(timer);
}, 1000);
});
}
et_pb_countdown_timer_init($et_pb_countdown_timer);
}
if($et_pb_tabs.length||is_frontend_builder){
window.et_pb_tabs_init=function($et_pb_tabs){
var $et_pb_tabs_li=$et_pb_tabs.find('.et_pb_tabs_controls li');
$et_pb_tabs.et_pb_simple_slider({
use_controls:false,
use_arrows:false,
slide:'.et_pb_all_tabs > div',
tabs_animation:true
}).on('et_hashchange', function(event){
var params=event.params;
var $the_tabs=$('#' + event.target.id);
var active_tab=params[0];
if(!$the_tabs.find('.et_pb_tabs_controls li').eq(active_tab).hasClass('et_pb_tab_active')){
$the_tabs.find('.et_pb_tabs_controls li').eq(active_tab).click();
}});
$et_pb_tabs_li.click(function(){
var $this_el=$(this),
$tabs_container=$this_el.closest('.et_pb_tabs').data('et_pb_simple_slider');
if($tabs_container.et_animation_running) return false;
$this_el.addClass('et_pb_tab_active').siblings().removeClass('et_pb_tab_active');
$tabs_container.data('et_pb_simple_slider').et_slider_move_to($this_el.index());
if($this_el.closest('.et_pb_tabs').attr('id')){
var tab_state=[];
tab_state.push($this_el.closest('.et_pb_tabs').attr('id'));
tab_state.push($this_el.index());
tab_state=tab_state.join(et_hash_module_param_seperator);
et_set_hash(tab_state);
}
return false;
});
window.et_pb_set_tabs_height();
}
window.et_pb_tabs_init($et_pb_tabs);
}
if($et_pb_map.length||is_frontend_builder){
function et_pb_init_maps(){
$et_pb_map.each(function(){
et_pb_map_init($(this));
});
}
window.et_pb_map_init=function($this_map_container){
if(typeof google==='undefined'){
return;
}
var $this_map=$this_map_container.children('.et_pb_map'),
this_map_grayscale=$this_map_container.attr('data-grayscale')||0,
is_draggable=(et_is_mobile_device&&$this_map.data('mobile-dragging')!=='off')||! et_is_mobile_device,
infowindow_active;
if(this_map_grayscale!==0){
this_map_grayscale='-' + this_map_grayscale.toString();
}
$this_map_container.data('map', new google.maps.Map($this_map[0], {
zoom: parseInt($this_map.attr('data-zoom')),
center: new google.maps.LatLng(parseFloat($this_map.attr('data-center-lat')) , parseFloat($this_map.attr('data-center-lng'))),
mapTypeId: google.maps.MapTypeId.ROADMAP,
scrollwheel: $this_map.attr('data-mouse-wheel')=='on' ? true:false,
draggable: is_draggable,
panControlOptions: {
position: $this_map_container.is('.et_beneath_transparent_nav') ? google.maps.ControlPosition.LEFT_BOTTOM:google.maps.ControlPosition.LEFT_TOP
},
zoomControlOptions: {
position: $this_map_container.is('.et_beneath_transparent_nav') ? google.maps.ControlPosition.LEFT_BOTTOM:google.maps.ControlPosition.LEFT_TOP
},
styles: [ {
stylers: [
{ saturation: parseInt(this_map_grayscale) }
]
} ]
}));
$this_map_container.find('.et_pb_map_pin').each(function(){
var $this_marker=$(this);
var marker=new google.maps.Marker({
position: new google.maps.LatLng(parseFloat($this_marker.attr('data-lat')) , parseFloat($this_marker.attr('data-lng'))),
map: $this_map_container.data('map'),
title: $this_marker.attr('data-title'),
icon: { url: et_pb_custom.builder_images_uri + '/marker.png', size: new google.maps.Size(46, 43), anchor: new google.maps.Point(16, 43) },
shape: { coord: [1, 1, 46, 43], type: 'rect' },
anchorPoint: new google.maps.Point(0, -45)
});
if($this_marker.find('.infowindow').length){
var infowindow=new google.maps.InfoWindow({
content: $this_marker.html()
});
google.maps.event.addListener($this_map_container.data('map'), 'click', function(){
infowindow.close();
});
google.maps.event.addListener(marker, 'click', function(){
if(infowindow_active){
infowindow_active.close();
}
infowindow_active=infowindow;
infowindow.open($this_map_container.data('map'), marker);
});
}});
}
if(window.et_load_event_fired){
et_pb_init_maps();
}else{
if(typeof google!=='undefined'){
google.maps.event.addDomListener(window, 'load', function(){
et_pb_init_maps();
});
}}
}
if($et_pb_shop.length){
$et_pb_shop.each(function(){
var $this_el=$(this),
icon=$this_el.data('icon')||'';
if(icon===''){
return true;
}
$this_el.find('.et_overlay')
.attr('data-icon', icon)
.addClass('et_pb_inline_icon');
});
}
if($et_pb_circle_counter.length||is_frontend_builder){
window.et_pb_circle_counter_init=function($the_counter, animate){
if(0===$the_counter.width()){
return;
}
$the_counter.easyPieChart({
animate: {
duration: 1800,
enabled: true
},
size: 0!==$the_counter.width() ? $the_counter.width():10,
barColor: $the_counter.data('bar-bg-color'),
trackColor: $the_counter.data('color')||'#000000',
trackAlpha: $the_counter.data('alpha')||'0.1',
scaleColor: false,
lineWidth: 5,
onStart: function(){
$(this.el).find('.percent p').css({ 'visibility':'visible' });
},
onStep: function(from, to, percent){
$(this.el).find('.percent-value').text(Math.round(parseInt(percent)));
},
onStop: function(from, to){
$(this.el).find('.percent-value').text($(this.el).data('number-value'));
}});
}
window.et_pb_reinit_circle_counters=function($et_pb_circle_counter){
$et_pb_circle_counter.each(function(){
var $the_counter=$(this);
window.et_pb_circle_counter_init($the_counter, false);
$the_counter.on('containerWidthChanged', function(event){
$the_counter=$(event.target);
$the_counter.find('canvas').remove();
$the_counter.removeData('easyPieChart');
window.et_pb_circle_counter_init($the_counter, true);
});
});
}
window.et_pb_reinit_circle_counters($et_pb_circle_counter);
}
if($et_pb_number_counter.length||is_frontend_builder){
window.et_pb_reinit_number_counters=function($et_pb_number_counter){
function et_format_number(number_value){
var separator=$et_pb_number_counter.data('number-separator');
return number_value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, separator);
}
if($.fn.fitText){
$et_pb_number_counter.find('.percent p').fitText(0.3);
}
$et_pb_number_counter.each(function(){
var $this_counter=$(this);
$this_counter.easyPieChart({
animate: {
duration: 1800,
enabled: true
},
size: 0,
trackColor: false,
scaleColor: false,
lineWidth: 0,
onStart: function(){
$(this.el).find('.percent p').css({ 'visibility':'visible' });
},
onStep: function(from, to, percent){
if(percent!=to)
$(this.el).find('.percent-value').text(et_format_number(Math.round(parseInt(percent))));
},
onStop: function(from, to){
$(this.el).find('.percent-value').text(et_format_number($(this.el).data('number-value')));
}});
});
}
window.et_pb_reinit_number_counters($et_pb_number_counter);
}
window.et_apply_parallax=function(){
if(! $(this).length||typeof $(this)==='undefined'||typeof $(this).offset()==='undefined'){
return;
}
var $this=$(this),
element_top=$this.offset().top,
window_top=$et_window.scrollTop(),
y_pos=(((window_top + $et_window.height()) - element_top) * 0.3),
main_position;
main_position='translate(0, ' + y_pos + 'px)';
$this.find('.et_parallax_bg').css({
'-webkit-transform':main_position,
'-moz-transform':main_position,
'-ms-transform':main_position,
'transform':main_position
});
}
window.et_parallax_set_height=function(){
var $this=$(this),
bg_height;
bg_height=($et_window.height() * 0.3 + $this.innerHeight());
$this.find('.et_parallax_bg').css({ 'height':bg_height });
}
function et_toggle_animation_callback(initial_toggle_state, $module, $section){
if('closed'===initial_toggle_state){
$module.removeClass('et_pb_toggle_close').addClass('et_pb_toggle_open');
}else{
$module.removeClass('et_pb_toggle_open').addClass('et_pb_toggle_close');
}
if($section.hasClass('et_pb_section_parallax')&&!$section.children().hasClass('et_pb_parallax_css')){
$.proxy(et_parallax_set_height, $section)();
}}
$('body').on('click', '.et_pb_toggle_title, .et_fb_toggle_overlay', function(){
var $this_heading=$(this),
$module=$this_heading.closest('.et_pb_toggle'),
$section=$module.parents('.et_pb_section'),
$content=$module.find('.et_pb_toggle_content'),
$accordion=$module.closest('.et_pb_accordion'),
is_accordion=$accordion.length,
is_accordion_toggling=$accordion.hasClass('et_pb_accordion_toggling'),
window_offset_top=$(window).scrollTop(),
fixed_header_height=0,
initial_toggle_state=$module.hasClass('et_pb_toggle_close') ? 'closed':'opened',
$accordion_active_toggle,
module_offset;
if(is_accordion){
if($module.hasClass('et_pb_toggle_open')||is_accordion_toggling){
return false;
}
$accordion.addClass('et_pb_accordion_toggling');
$accordion_active_toggle=$module.siblings('.et_pb_toggle_open');
}
if($content.is(':animated')){
return;
}
if($('body').hasClass('safari')){
$content.fadeToggle(700, function(){
et_toggle_animation_callback(initial_toggle_state, $module, $section);
});
}else{
$content.slideToggle(700, function(){
et_toggle_animation_callback(initial_toggle_state, $module, $section);
});
}
if(is_accordion){
$accordion_active_toggle.find('.et_pb_toggle_content').slideToggle(700, function(){
$accordion_active_toggle.removeClass('et_pb_toggle_open').addClass('et_pb_toggle_close');
$accordion.removeClass('et_pb_accordion_toggling');
module_offset=$module.offset();
if($('#wpadminbar').length){
fixed_header_height +=$('#wpadminbar').height();
}
if($('#top-header').length){
fixed_header_height +=$('#top-header').height();
}
if($('#main-header').length&&! window.et_is_vertical_nav){
fixed_header_height +=$('#main-header').height();
}
if(( window_offset_top + fixed_header_height) > module_offset.top){
$('html, body').animate({ scrollTop:(module_offset.top - fixed_header_height - 50) });
}});
}});
var $et_contact_container=$('.et_pb_contact_form_container');
if($et_contact_container.length){
$et_contact_container.each(function(){
var $this_contact_container=$(this),
$et_contact_form=$this_contact_container.find('form'),
$et_contact_submit=$this_contact_container.find('input.et_pb_contact_submit'),
$et_inputs=$et_contact_form.find('input[type=text],textarea'),
et_email_reg=/^[\w-]+(\.[\w-]+)*@([a-z0-9-]+(\.[a-z0-9-]+)*?\.[a-z]{2,6}|(\d{1,3}\.){3}\d{1,3})(:\d{4})?$/,
redirect_url=typeof $this_contact_container.data('redirect_url')!=='undefined' ? $this_contact_container.data('redirect_url'):'';
$et_contact_form.on('submit', function(event){
var $this_contact_form=$(this),
$this_inputs=$this_contact_form.find('input[type=text],textarea'),
this_et_contact_error=false,
$et_contact_message=$this_contact_form.closest('.et_pb_contact_form_container').find('.et-pb-contact-message'),
et_message='',
et_fields_message='',
$this_contact_container=$this_contact_form.closest('.et_pb_contact_form_container'),
$captcha_field=$this_contact_form.find('.et_pb_contact_captcha'),
form_unique_id=typeof $this_contact_container.data('form_unique_num')!=='undefined' ? $this_contact_container.data('form_unique_num'):0,
inputs_list=[];
et_message='
';
$this_inputs.removeClass('et_contact_error');
$this_inputs.each(function(){
var $this_el=$(this),
this_val=$this_el.val(),
this_label=$this_el.siblings('label').text(),
field_type=typeof $this_el.data('field_type')!=='undefined' ? $this_el.data('field_type'):'text',
required_mark=typeof $this_el.data('required_mark')!=='undefined' ? $this_el.data('required_mark'):'not_required',
original_id=typeof $this_el.data('original_id')!=='undefined' ? $this_el.data('original_id'):'',
default_value;
if(typeof $this_el.attr('id')!=='undefined'){
inputs_list.push({ 'field_id':$this_el.attr('id'), 'original_id':original_id, 'required_mark':required_mark, 'field_type':field_type, 'field_label':this_label });
}
if('required'===required_mark&&(''===this_val||this_label===this_val)){
$this_el.addClass('et_contact_error');
this_et_contact_error=true;
default_value=this_label;
if(''===default_value){
default_value=et_pb_custom.captcha;
}
et_fields_message +='- ' + default_value + '
';
}
if('email'===field_type&&''!==this_val&&this_label!==this_val&&! et_email_reg.test(this_val)){
$this_el.addClass('et_contact_error');
this_et_contact_error=true;
if(! et_email_reg.test(this_val)){
et_message +='- ' + et_pb_custom.invalid + '
';
}}
});
if($captcha_field.length&&''!==$captcha_field.val()){
var first_digit=parseInt($captcha_field.data('first_digit')),
second_digit=parseInt($captcha_field.data('second_digit'));
if(parseInt($captcha_field.val())!==first_digit + second_digit){
et_message +='- ' + et_pb_custom.wrong_captcha + '
';
this_et_contact_error=true;
first_digit=Math.floor(( Math.random() * 15) + 1);
second_digit=Math.floor(( Math.random() * 15) + 1);
$captcha_field.data('first_digit', first_digit);
$captcha_field.data('second_digit', second_digit);
$this_contact_form.find('.et_pb_contact_captcha_question').empty().append(first_digit + ' + ' + second_digit);
}}
if(! this_et_contact_error){
var $href=$(this).attr('action'),
form_data=$(this).serializeArray();
form_data.push({ 'name': 'et_pb_contact_email_fields_' + form_unique_id, 'value':JSON.stringify(inputs_list) });
$this_contact_container.fadeTo('fast', 0.2).load($href + ' #' + $this_contact_form.closest('.et_pb_contact_form_container').attr('id'), form_data, function(responseText){
if(! $(responseText).find('.et_pb_contact_error_text').length){
et_pb_maybe_log_event($this_contact_container, 'con_goal');
if(''!==redirect_url){
window.location.href=redirect_url;
}}
$this_contact_container.fadeTo('fast', 1);
});
}
et_message +='
';
if(''!==et_fields_message){
if(et_message!='
'){
et_message='
' + et_pb_custom.contact_error_message + '
' + et_message;
}
et_fields_message='
' + et_fields_message + '
';
et_fields_message='
' + et_pb_custom.fill_message + '
' + et_fields_message;
et_message=et_fields_message + et_message;
}
if(et_message!='
'){
$et_contact_message.html(et_message);
if($this_contact_container.parents('.et_pb_section_parallax').length){
$this_contact_container.parents('.et_pb_section_parallax').each(function(){
var $parallax_element=$(this),
$parallax=$parallax_element.children('.et_parallax_bg'),
is_true_parallax=(! $parallax.hasClass('et_pb_parallax_css'));
if(is_true_parallax){
$et_window.trigger('resize');
}});
}}
event.preventDefault();
});
});
}
window.et_pb_play_overlayed_video=function($play_video){
var $this=$play_video,
$video_image=$this.closest('.et_pb_video_overlay'),
$wrapper=$this.closest('.et_pb_video, .et_main_video_container, .et_pb_video_wrap'),
$video_iframe=$wrapper.find('iframe'),
is_embedded=$video_iframe.length ? true:false,
video_iframe_src,
video_iframe_src_splitted,
video_iframe_src_autoplay;
if(is_embedded){
video_iframe_src=$video_iframe.attr('src');
video_iframe_src_splitted=video_iframe_src.split("?");
if(video_iframe_src.indexOf('autoplay=')!==-1){
return;
}
if(typeof video_iframe_src_splitted[1]!=='undefined'){
video_iframe_src_autoplay=video_iframe_src_splitted[0] + "?autoplay=1&" + video_iframe_src_splitted[1];
}else{
video_iframe_src_autoplay=video_iframe_src_splitted[0] + "?autoplay=1";
}
$video_iframe.attr({
'src': video_iframe_src_autoplay
});
}else{
$wrapper.find('video').get(0).play();
}
$video_image.fadeTo(500, 0, function(){
var $image=$(this);
$image.css('display', 'none');
});
};
$('.et_pb_post .et_pb_video_overlay, .et_pb_video .et_pb_video_overlay, .et_pb_video_wrap .et_pb_video_overlay').click(function(){
var $this=$(this);
et_pb_play_overlayed_video($this);
return false;
});
window.et_pb_resize_section_video_bg=function($video){
$element=typeof $video!=='undefined' ? $video.closest('.et_pb_section_video_bg'):$('.et_pb_section_video_bg');
$element.each(function(){
var $this_el=$(this);
var el_ratio=parseFloat($this_el.attr('data-ratio'));
var el_width=parseInt($this_el.find('video').attr('width'));
var el_height=parseInt($this_el.find('video').attr('height'));
var ratio=(! isNaN(el_ratio)) ? el_ratio:(el_width / el_height);
var $video_elements=$this_el.find('.mejs-video, video, object').css('margin', 0);
var $container=$this_el.closest('.et_pb_section_video').length
? $this_el.closest('.et_pb_section_video')
: $this_el.closest('.et_pb_slides');
var body_width=$container.innerWidth();
var container_height=$container.innerHeight();
var width, height;
if(typeof $this_el.attr('data-ratio')=='undefined'&&!isNaN(ratio)){
$this_el.attr('data-ratio', ratio);
}
if(body_width / container_height < ratio){
width=container_height * ratio;
height=container_height;
}else{
width=body_width;
height=body_width / ratio;
}
$video_elements.width(width).height(height);
if(is_frontend_builder){
setTimeout(function(){
$video_elements.width(width).height(height);
}, 0);
}});
};
window.et_pb_center_video=function($video){
$element=typeof $video!=='undefined' ? $video:$('.et_pb_section_video_bg .mejs-video');
if(! $element.length){
return;
}
$element.each(function(){
var $this_el=$(this);
et_pb_adjust_video_margin($this_el);
if(is_frontend_builder){
setTimeout(function(){
et_pb_adjust_video_margin($this_el);
}, 0);
}
if(typeof $video!=='undefined'){
if($video.closest('.et_pb_slider').length&&! $video.closest('.et_pb_first_video').length){
return false;
}}
});
};
window.et_pb_adjust_video_margin=function($el){
var $video_width=$el.width() / 2;
var $video_width_negative=0 - $video_width;
$el.css("margin-left", $video_width_negative);
}
window.et_fix_slider_height=function($slider){
var $this_slider=$slider||$et_pb_slider;
if(! $this_slider||! $this_slider.length){
return;
}
$this_slider.each(function(){
var $slide_section=$(this).parent('.et_pb_section'),
$slides=$(this).find('.et_pb_slide'),
$slide_containers=$slides.find('.et_pb_container'),
max_height=0,
image_margin=0,
need_image_margin_top=$(this).hasClass('et_pb_post_slider_image_top'),
need_image_margin_bottom=$(this).hasClass('et_pb_post_slider_image_bottom');
if($slide_section.is('.et_pb_section_first')){
return true;
}
$slide_containers.css('height', 0);
$slides.addClass('et_pb_temp_slide');
if(typeof $(this).data('et_pb_simple_slider')==='object'){
$(this).data('et_pb_simple_slider').et_fix_slider_content_images();
}
$slides.each(function(){
var height=parseFloat($(this).innerHeight()),
$slide_image=$(this).find('.et_pb_slide_image'),
adjustedHeight=parseFloat($(this).data('adjustedHeight')),
autoTopPadding=isNaN(adjustedHeight) ? 0:adjustedHeight;
height=(autoTopPadding&&autoTopPadding < height) ?(height - autoTopPadding):height;
if(need_image_margin_top||need_image_margin_bottom){
if($slide_image.length){
image_margin=need_image_margin_top ? parseFloat($slide_image.css('margin-top')):parseFloat($slide_image.css('margin-bottom'));
image_margin +=10;
}else{
$(this).find('.et_pb_container').addClass('et_pb_no_image');
}}
if(0===Math.abs(parseInt($(this).find('.et_pb_slide_description').height()))){
$(this).find('.et_pb_container').addClass('et_pb_empty_slide');
}
if(max_height < height){
max_height=height;
}});
if(( max_height + image_margin) < 1){
$slide_containers.css('height', '');
}else{
$slide_containers.css('height', max_height + image_margin);
}
$slides.removeClass('et_pb_temp_slide');
$slides.filter('.et-pb-active-slide')
.find('.et_pb_slide_image')
.children('img')
.addClass('active');
});
};
function et_fix_nav_direction(){
window_width=$(window).width();
$('.nav li.et-reverse-direction-nav').removeClass('et-reverse-direction-nav');
$('.nav li li ul').each(function(){
var $dropdown=$(this),
dropdown_width=$dropdown.width(),
dropdown_offset=$dropdown.offset(),
$parents=$dropdown.parents('.nav > li');
if(dropdown_offset.left >(window_width - dropdown_width)){
$parents.addClass('et-reverse-direction-nav');
}});
}
et_fix_nav_direction();
et_pb_form_placeholders_init($('.et_pb_newsletter_form, .et_pb_comments_module #commentform'));
$('.et_pb_fullwidth_menu ul.nav').each(function(i){
i++;
et_duplicate_menu($(this), $(this).parents('.et_pb_row').find('div .mobile_nav'), 'mobile_menu' + i, 'et_mobile_menu');
});
$('.et_pb_fullwidth_menu').each(function(){
var this_menu=$(this),
bg_color=this_menu.data('bg_color');
if(bg_color){
this_menu.find('ul').css({ 'background-color':bg_color });
}});
$et_pb_newsletter_button.click(function(event){
et_pb_submit_newsletter($(this), event);
});
window.et_pb_submit_newsletter=function($submit, event){
if($submit.closest('.et_pb_login_form').length||$submit.closest('.et_pb_feedburner_form').length){
et_pb_maybe_log_event($submit.closest('.et_pb_newsletter'), 'con_goal');
return;
}
if(typeof event!=='undefined'){
event.preventDefault();
}
var $newsletter_container=$submit.closest('.et_pb_newsletter'),
$firstname=$newsletter_container.find('input[name="et_pb_signup_firstname"]'),
$lastname=$newsletter_container.find('input[name="et_pb_signup_lastname"]'),
$email=$newsletter_container.find('input[name="et_pb_signup_email"]'),
list_id=$newsletter_container.find('input[name="et_pb_signup_list_id"]').val(),
$result=$newsletter_container.find('.et_pb_newsletter_result').hide(),
service=$submit.closest('.et_pb_newsletter_form').data('service')||'mailchimp',
account=$newsletter_container.find('input[name="et_pb_signup_account_name"]').val();
$firstname.removeClass('et_pb_signup_error');
$lastname.removeClass('et_pb_signup_error');
$email.removeClass('et_pb_signup_error');
et_pb_remove_placeholder_text($submit.closest('.et_pb_newsletter_form'));
if($firstname.val()==''||$email.val()==''||list_id===''){
if($firstname.val()=='') $firstname.addClass('et_pb_signup_error');
if($email.val()=='') $email.addClass('et_pb_signup_error');
if($firstname.val()=='')
$firstname.val($firstname.siblings('.et_pb_contact_form_label').text());
if($lastname.val()=='')
$lastname.val($lastname.siblings('.et_pb_contact_form_label').text());
if($email.val()=='')
$email.val($email.siblings('.et_pb_contact_form_label').text());
return;
}
$.ajax({
type: "POST",
url: et_pb_custom.ajaxurl,
dataType: "json",
data:
{
action:'et_pb_submit_subscribe_form',
et_frontend_nonce:et_pb_custom.et_frontend_nonce,
et_list_id:list_id,
et_firstname:$firstname.val(),
et_lastname:$lastname.val(),
et_email:$email.val(),
et_service:service,
et_account: account
},
beforeSend: function(){
$newsletter_container
.find('.et_pb_newsletter_button')
.addClass('et_pb_button_text_loading')
.find('.et_subscribe_loader')
.show();
},
complete: function(){
$newsletter_container
.find('.et_pb_newsletter_button')
.removeClass('et_pb_button_text_loading')
.find('.et_subscribe_loader')
.hide();
},
success: function(data){
if(data){
if(data.error){
$result.html(data.error).show();
}
if(data.success){
$newsletter_container.find('.et_pb_newsletter_form > p').hide();
$result.html(data.success).show();
et_pb_maybe_log_event($newsletter_container, 'con_goal');
}}else{
$result.html(et_pb_custom.subscription_failed).show();
}}
});
};
window.et_fix_testimonial_inner_width=function(){
var window_width=$(window).width();
if(window_width > 767){
$('.et_pb_testimonial').each(function(){
if(! $(this).is(':visible')){
return;
}
var $testimonial=$(this),
testimonial_width=$testimonial.width(),
$portrait=$testimonial.find('.et_pb_testimonial_portrait'),
portrait_width=$portrait.width(),
$testimonial_inner=$testimonial.find('.et_pb_testimonial_description_inner'),
$outer_column=$testimonial.closest('.et_pb_column'),
testimonial_inner_width=testimonial_width,
subtract = !($outer_column.hasClass('et_pb_column_1_3')||$outer_column.hasClass('et_pb_column_1_4')||$outer_column.hasClass('et_pb_column_3_8')) ? portrait_width + 31:0;
$testimonial_inner.width(testimonial_inner_width - subtract);
});
}else{
$('.et_pb_testimonial_description_inner').removeAttr('style');
}}
window.et_fix_testimonial_inner_width();
window.et_pb_video_background_init=function($this_video_background, this_video_background){
var $video_background_wrapper=$this_video_background.closest('.et_pb_section_video_bg');
var onplaying=false;
var onpause=true;
this_video_background.onplaying=function(){
onplaying=true;
onpause=false;
};
this_video_background.onpause=function(){
onplaying=false;
onpause=true;
};
$video_background_wrapper.waypoint({
offset: '100%',
handler:function(direction){
if($this_video_background.is(':visible')&&direction==='down'){
if(this_video_background.paused&&! onplaying){
this_video_background.play();
}}else if($this_video_background.is(':visible')&&direction==='up'){
if(! this_video_background.paused&&! onpause){
this_video_background.pause();
}}
}});
$video_background_wrapper.waypoint({
offset: function(){
var video_height=this.element.clientHeight,
toggle_offset=Math.ceil(window.innerHeight / 2);
if(video_height > toggle_offset){
toggle_offset=video_height;
}
return toggle_offset * (-1);
},
handler:function(direction){
if($this_video_background.is(':visible')&&direction==='up'){
if(this_video_background.paused&&! onplaying){
this_video_background.play();
}}else if($this_video_background.is(':visible')&&direction==='down'){
if(! this_video_background.paused&&! onpause){
this_video_background.pause();
}}
}});
}
window.et_reinit_waypoint_modules=et_pb_debounce(function(){
var $et_pb_circle_counter=$('.et_pb_circle_counter'),
$et_pb_number_counter=$('.et_pb_number_counter'),
$et_pb_video_background=$('.et_pb_section_video_bg video');
if($.fn.waypoint&&'yes'!==et_pb_custom.ignore_waypoints){
$('.et_pb_counter_container, .et-waypoint').waypoint({
offset: '75%',
handler: function(){
$(this.element).addClass('et-animated');
}});
$('.et_pb_counter_container, .et-waypoint').waypoint({
offset: 'bottom-in-view',
handler: function(){
$(this.element).addClass('et-animated');
}});
if($et_pb_circle_counter.length){
$et_pb_circle_counter.each(function(){
var $this_counter=$(this);
if(! $this_counter.is(':visible')){
return;
}
$this_counter.waypoint({
offset: '65%',
handler: function(){
if($this_counter.data('PieChartHasLoaded')||typeof $this_counter.data('easyPieChart')==='undefined'){
return;
}
$this_counter.data('easyPieChart').update($this_counter.data('number-value'));
$this_counter.data('PieChartHasLoaded', true);
}});
$this_counter.waypoint({
offset: 'bottom-in-view',
handler: function(){
if($this_counter.data('PieChartHasLoaded')||typeof $this_counter.data('easyPieChart')==='undefined'){
return;
}
$this_counter.data('easyPieChart').update($this_counter.data('number-value'));
$this_counter.data('PieChartHasLoaded', true);
}});
});
}
if($et_pb_number_counter.length){
$et_pb_number_counter.each(function(){
var $this_counter=$(this);
$this_counter.waypoint({
offset: '75%',
handler: function(){
$this_counter.data('easyPieChart').update($this_counter.data('number-value'));
}});
$this_counter.waypoint({
offset: 'bottom-in-view',
handler: function(){
$this_counter.data('easyPieChart').update($this_counter.data('number-value'));
}});
});
}
if($('.et_pb_ab_goal').length){
var $et_pb_ab_goal=$('.et_pb_ab_goal');
$et_pb_ab_goal.waypoint({
offset: '80%',
handler: function(){
if(et_pb_ab_logged_status['read_goal']||! $et_pb_ab_goal.length||! $et_pb_ab_goal.visible(true)){
return;
}
setTimeout(function(){
if($et_pb_ab_goal.length&&$et_pb_ab_goal.visible(true)&&! et_pb_ab_logged_status['read_goal']){
et_pb_ab_update_stats('read_goal');
}}, 3000);
et_pb_maybe_log_event($et_pb_ab_goal, 'view_goal');
}});
}}else{
$('.et_pb_counter_container, .et-waypoint').addClass('et-animated');
if($et_pb_circle_counter.length){
$et_pb_circle_counter.each(function(){
var $this_counter=$(this);
if(! $this_counter.is(':visible')){
return;
}
if($this_counter.data('PieChartHasLoaded')){
return;
}
$this_counter.data('easyPieChart').update($this_counter.data('number-value'));
$this_counter.data('PieChartHasLoaded', true);
});
}
if($et_pb_number_counter.length){
$et_pb_number_counter.each(function(){
var $this_counter=$(this);
$this_counter.data('easyPieChart').update($this_counter.data('number-value'));
});
}
if($('.et_pb_ab_goal').length){
var $et_pb_ab_goal=$('.et_pb_ab_goal');
if(et_pb_ab_logged_status['read_goal']||! $et_pb_ab_goal.length||! $et_pb_ab_goal.visible(true)){
return;
}
setTimeout(function(){
if($et_pb_ab_goal.length&&$et_pb_ab_goal.visible(true)&&! et_pb_ab_logged_status['read_goal']){
et_pb_ab_update_stats('read_goal');
}}, 3000);
et_pb_maybe_log_event($et_pb_ab_goal, 'view_goal');
}}
if($et_pb_video_background.length){
$et_pb_video_background.each(function(){
var $this_video_background=$(this);
et_pb_video_background_init($this_video_background, this);
});
}}, 100);
function et_pb_init_ab_test(){
var $et_pb_ab_goal=$('.et_pb_ab_goal'),
et_ab_subject_id=et_pb_get_subject_id();
$.each(et_pb_ab_logged_status, function(key, value){
var cookie_subject='click_goal'===key||'con_short'===key ? '':et_ab_subject_id;
et_pb_ab_logged_status[key]=et_pb_check_cookie_value('et_pb_ab_' + key + '_' + et_pb_custom.page_id + et_pb_custom.unique_test_id + cookie_subject, 'true');
});
if(! et_pb_ab_logged_status['read_page']){
setTimeout(function(){
et_pb_ab_update_stats('read_page');
}, et_pb_ab_bounce_rate);
}
if('on'===et_pb_custom.is_shortcode_tracking&&! et_pb_ab_logged_status['con_short']){
et_pb_set_cookie(365, 'et_pb_ab_shortcode_track_' + et_pb_custom.page_id + '=' + et_pb_custom.page_id + '_' + et_pb_get_subject_id() + '_' + et_pb_custom.unique_test_id);
}
if($et_pb_ab_goal.length){
if($et_pb_ab_goal.hasClass('et_pb_module')&&($et_pb_ab_goal.hasClass('et_pb_button')||$et_pb_ab_goal.find('.et_pb_button').length)){
if(! $et_pb_ab_goal.hasClass('et_pb_contact_form_container')&&! $et_pb_ab_goal.hasClass('et_pb_newsletter')){
var $goal_button=$et_pb_ab_goal.hasClass('et_pb_button') ? $et_pb_ab_goal:$et_pb_ab_goal.find('.et_pb_button');
if($et_pb_ab_goal.hasClass('et_pb_comments_module')){
var page_url=window.location.href,
comment_submitted=-1!==page_url.indexOf('#comment-') ? true:false,
log_conversion=et_pb_check_cookie_value('et_pb_ab_comment_log_' + et_pb_custom.page_id + et_pb_custom.unique_test_id, 'true');
if(comment_submitted&&log_conversion){
et_pb_ab_update_stats('con_goal');
et_pb_set_cookie(0, 'et_pb_ab_comment_log_' + et_pb_custom.page_id + et_pb_custom.unique_test_id + '=true');
}}
$goal_button.click(function(){
if($et_pb_ab_goal.hasClass('et_pb_comments_module')&&! et_pb_ab_logged_status['con_goal']){
et_pb_set_cookie(365, 'et_pb_ab_comment_log_' + et_pb_custom.page_id + et_pb_custom.unique_test_id + '=true');
return;
}
et_pb_maybe_log_event($et_pb_ab_goal, 'click_goal');
});
}}else{
$et_pb_ab_goal.click(function(){
if($et_pb_ab_goal.hasClass('et_pb_shop')&&! et_pb_ab_logged_status['con_goal']){
et_pb_set_cookie(365, 'et_pb_ab_shop_log=' + et_pb_custom.page_id + '_' + et_pb_get_subject_id() + '_' + et_pb_custom.unique_test_id);
}
et_pb_maybe_log_event($et_pb_ab_goal, 'click_goal');
});
}}
}
function et_pb_maybe_log_event($goal_container, event){
var log_event=typeof event==='undefined' ? 'con_goal':event;
if(! $goal_container.hasClass('et_pb_ab_goal')||et_pb_ab_logged_status[ log_event ]){
return;
}
et_pb_ab_update_stats(log_event);
}
function et_pb_ab_update_stats(record_type, set_page_id, set_subject_id, set_test_id){
var subject_id=typeof set_subject_id==='undefined' ? et_pb_get_subject_id():set_subject_id,
page_id=typeof set_page_id==='undefined' ? et_pb_custom.page_id:set_page_id,
test_id=typeof set_test_id==='undefined' ? et_pb_custom.unique_test_id:set_test_id,
stats_data=JSON.stringify({ 'test_id':page_id, 'subject_id':subject_id, 'record_type':record_type }),
cookie_subject='click_goal'===record_type||'con_short'===record_type ? '':subject_id;
et_pb_set_cookie(365, 'et_pb_ab_' + record_type + '_' + page_id + test_id + cookie_subject + '=true');
et_pb_ab_logged_status[record_type]=true;
$.ajax({
type: 'POST',
url: et_pb_custom.ajaxurl,
data: {
action:'et_pb_update_stats_table',
stats_data_array:stats_data,
et_ab_log_nonce:et_pb_custom.et_ab_log_nonce
}});
}
function et_pb_get_subject_id(){
var $subject=$('.et_pb_ab_subject');
if($subject.length <=0){
return false;
}
var subject_classname=$subject.attr('class'),
subject_id_raw=subject_classname.split('et_pb_ab_subject_id-')[1],
subject_id_clean=subject_id_raw.split(' ')[0],
subject_id_separated=subject_id_clean.split('_'),
subject_id=subject_id_separated[1];
return subject_id;
}
function et_pb_set_cookie_expire(days){
var ms=days*24*60*60*1000;
var date=new Date();
date.setTime(date.getTime() + ms);
return "; expires=" + date.toUTCString();
}
function et_pb_check_cookie_value(cookie_name, value){
return et_pb_get_cookie_value(cookie_name)==value;
}
function et_pb_get_cookie_value(cookie_name){
return et_pb_parse_cookies()[cookie_name];
}
function et_pb_parse_cookies(){
var cookies=document.cookie.split('; ');
var ret={};
for(var i=cookies.length - 1; i >=0; i--){
var el=cookies[i].split('=');
ret[el[0]]=el[1];
}
return ret;
}
function et_pb_set_cookie(expire, cookie_content){
cookie_expire=et_pb_set_cookie_expire(expire);
document.cookie=cookie_content + cookie_expire + "; path=/";
}
function et_pb_get_fixed_main_header_height(){
if(! window.et_is_fixed_nav){
return 0;
}
var fixed_height_onload=typeof $('#main-header').attr('data-fixed-height-onload')==='undefined' ? 0:$('#main-header').attr('data-fixed-height-onload');
return ! window.et_is_fixed_nav ? 0:parseFloat(fixed_height_onload);
}
var fullscreen_section_width={};
var fullscreen_section_timeout={};
window.et_calc_fullscreen_section=function(event){
var isResizing=typeof event==='object'&&event.type==='resize',
$et_window=$(window),
$this_section=$(this),
section_index=$this_section.index('.et_pb_fullscreen'),
timeout=isResizing&&typeof fullscreen_section_width[section_index]!=='undefined'&&event.target.window_width > fullscreen_section_width[section_index] ? 800:0;
fullscreen_section_width[section_index]=$et_window.width();
if(typeof fullscreen_section_timeout[section_index]!=='undefined'){
clearTimeout(fullscreen_section_timeout[section_index]);
}
fullscreen_section_timeout[section_index]=setTimeout(function(){
var $body=$('body'),
this_section_index=$this_section.index('.et_pb_fullwidth_header'),
this_section_offset=$this_section.offset(),
$header=$this_section.children('.et_pb_fullwidth_header_container'),
$header_content=$header.children('.header-content-container'),
$header_image=$header.children('.header-image-container'),
sectionHeight=window.innerHeight||$et_window.height(),
$wpadminbar=$('#wpadminbar'),
has_wpadminbar=$wpadminbar.length,
wpadminbar_height=has_wpadminbar ? $wpadminbar.height():0,
$top_header=$('#top-header'),
has_top_header=$top_header.length,
top_header_height=has_top_header ? $top_header.height():0,
$main_header=$('#main-header'),
has_main_header=$main_header.length,
main_header_height=has_main_header ? $main_header.outerHeight():0,
fixed_main_header_height=et_pb_get_fixed_main_header_height(),
is_mobile_first_module=this_section_offset.top <=(main_header_height + wpadminbar_height),
is_wp_relative_admin_bar=$et_window.width() < 782,
is_desktop_view=$et_window.width() > 980,
is_tablet_view=$et_window.width() <=980&&$et_window.width() >=479,
is_phone_view=$et_window.width() < 479,
overall_header_height=window.et_is_vertical_nav&&is_desktop_view ? wpadminbar_height + top_header_height:wpadminbar_height + top_header_height + main_header_height,
is_first_module=this_section_offset.top <=overall_header_height;
if($main_header.attr('data-height-onload')){
main_header_height=parseFloat($main_header.attr('data-height-onload'));
}
if(has_wpadminbar){
if(is_wp_relative_admin_bar){
if(is_first_module){
sectionHeight -=wpadminbar_height;
}}else{
sectionHeight -=wpadminbar_height;
}}
if(has_top_header){
if(is_desktop_view){
if(et_hide_nav&&! window.et_is_vertical_nav){
if(! is_first_module){
sectionHeight -=top_header_height;
}}else if(! window.et_is_fixed_nav||window.et_is_vertical_nav){
if(is_first_module){
sectionHeight -=top_header_height;
}}else{
sectionHeight -=top_header_height;
}}
}
if(has_main_header){
if(is_desktop_view){
if(et_hide_nav&&! window.et_is_vertical_nav){
if(! is_first_module){
sectionHeight -=fixed_main_header_height;
}}else if(window.et_is_fixed_nav&&! window.et_is_vertical_nav){
if(is_first_module){
sectionHeight -=main_header_height;
}else{
sectionHeight -=fixed_main_header_height;
}}else if(! window.et_is_fixed_nav&&! window.et_is_vertical_nav){
if(is_first_module){
sectionHeight -=main_header_height;
}}
}else{
if(is_first_module){
sectionHeight -=main_header_height;
}}
}
if($body.hasClass('et_transparent_nav')&&$body.hasClass('et_hide_nav')&&0===this_section_index){
$this_section.css('padding-top', '');
}
$this_section.css('min-height', sectionHeight + 'px');
$header.css('min-height', sectionHeight + 'px');
if($header.hasClass('center')&&$header_content.hasClass('bottom')&&$header_image.hasClass('bottom')){
$header.addClass('bottom-bottom');
}
if($header.hasClass('center')&&$header_content.hasClass('center')&&$header_image.hasClass('center')){
$header.addClass('center-center');
}
if($header.hasClass('center')&&$header_content.hasClass('center')&&$header_image.hasClass('bottom')){
$header.addClass('center-bottom');
var contentHeight=sectionHeight - $header_image.outerHeight(true);
if(contentHeight > 0){
$header_content.css('min-height', contentHeight + 'px');
}}
if($header.hasClass('center')&&$header_content.hasClass('bottom')&&$header_image.hasClass('center')){
$header.addClass('bottom-center');
}
if(( $header.hasClass('left')||$header.hasClass('right'))&&!$header_content.length&&$header_image.length){
$header.css('justify-content', 'flex-end');
}
if($header.hasClass('center')&&$header_content.hasClass('bottom')&&!$header_image.length){
$header_content.find('.header-content').css('margin-bottom', 80 + 'px');
}
if($header_content.hasClass('bottom')&&$header_image.hasClass('center')){
$header_image.find('.header-image').css('margin-bottom', 80 + 'px');
$header_image.css('align-self', 'flex-end');
}}, timeout);
}
window.et_pb_parallax_init=function($this_parallax){
if($this_parallax.hasClass('et_pb_parallax_css')){
return;
}
var $this_parent=$this_parallax.parent();
$.proxy(et_parallax_set_height, $this_parent)();
$.proxy(et_apply_parallax, $this_parent)();
$et_window.on('scroll', $.proxy(et_apply_parallax, $this_parent));
$et_window.on('resize', $.proxy(et_parallax_set_height, $this_parent));
$et_window.on('resize', $.proxy(et_apply_parallax, $this_parent));
$this_parent.find('.et-learn-more .heading-more').click(function(){
setTimeout(function(){
$.proxy(et_parallax_set_height, $this_parent)();
}, 300);
});
}
$(window).resize(function(){
var window_width=$et_window.width(),
et_container_css_width=$et_container.css('width'),
et_container_width_in_pixel=(typeof et_container_css_width!=='undefined') ? et_container_css_width.substr(-1, 1)!=='%':'',
et_container_actual_width=(et_container_width_in_pixel) ? $et_container.width():(( $et_container.width() / 100) * window_width),
containerWidthChanged=et_container_width!==et_container_actual_width;
et_pb_resize_section_video_bg();
et_pb_center_video();
et_fix_slider_height();
et_fix_nav_direction();
$et_pb_fullwidth_portfolio.each(function(){
set_container_height=$(this).hasClass('et_pb_fullwidth_portfolio_carousel') ? true:false;
set_fullwidth_portfolio_columns($(this), set_container_height);
});
if(containerWidthChanged){
$('.container-width-change-notify').trigger('containerWidthChanged');
setTimeout(function(){
$et_pb_filterable_portfolio.each(function(){
set_filterable_grid_items($(this));
});
$et_pb_gallery.each(function(){
if($(this).hasClass('et_pb_gallery_grid')){
set_gallery_grid_items($(this));
}});
}, 100);
et_container_width=et_container_actual_width;
etRecalculateOffset=true;
if($et_pb_circle_counter.length){
$et_pb_circle_counter.each(function(){
var $this_counter=$(this);
if(! $this_counter.is(':visible')){
return;
}
$this_counter.data('easyPieChart').update($this_counter.data('number-value'));
});
}
if($et_pb_countdown_timer.length){
$et_pb_countdown_timer.each(function(){
var timer=$(this);
et_countdown_timer_labels(timer);
});
}}
window.et_fix_testimonial_inner_width();
et_audio_module_set();
if($et_pb_counter_amount.length){
$et_pb_counter_amount.each(function(){
window.et_bar_counters_init($(this));
});
}
});
$(window).ready(function(){
if($.fn.fitVids){
$('.et_pb_slide_video').fitVids();
$('.et_pb_module').fitVids({ customSelector: "iframe[src^='http://www.hulu.com'], iframe[src^='http://www.dailymotion.com'], iframe[src^='http://www.funnyordie.com'], iframe[src^='https://embed-ssl.ted.com'], iframe[src^='http://embed.revision3.com'], iframe[src^='https://flickr.com'], iframe[src^='http://blip.tv'], iframe[src^='http://www.collegehumor.com']"});
}
et_fix_video_wmode('.fluid-width-video-wrapper');
et_fix_slider_height();
$('section.et_pb_fullscreen').each(function(){
var $this_section=$(this);
$.proxy(et_calc_fullscreen_section, $this_section)();
$et_window.on('resize', $.proxy(et_calc_fullscreen_section, $this_section));
});
});
window.et_pb_fullwidth_header_scroll=function(event){
event.preventDefault();
var window_width=$et_window.width(),
$body=$('body'),
is_wp_relative_admin_bar=window_width < 782,
is_transparent_main_header=$body.hasClass('et_transparent_nav'),
is_hide_nav=$body.hasClass('et_hide_nav'),
is_desktop_view=window_width > 980,
is_tablet_view=window_width <=980&&window_width >=479,
is_phone_view=window_width < 479,
$this_section=$(this).parents('section'),
this_section_offset=$this_section.offset(),
$wpadminbar=$('#wpadminbar'),
$main_header=$('#main-header'),
wpadminbar_height=$wpadminbar.length&&! is_wp_relative_admin_bar ? $wpadminbar.height():0,
top_header_height = !window.et_is_fixed_nav||!is_desktop_view ? 0:$top_header.height(),
data_height_onload=typeof $main_header.attr('data-height-onload')==='undefined' ? 0:$main_header.attr('data-height-onload');
initial_fixed_difference=$main_header.height()===et_pb_get_fixed_main_header_height()||! is_desktop_view||! window.et_is_fixed_nav||is_transparent_main_header||is_hide_nav ? 0:et_pb_get_fixed_main_header_height() - parseFloat(data_height_onload),
section_bottom=(this_section_offset.top + $this_section.outerHeight(true) + initial_fixed_difference) -(wpadminbar_height + top_header_height + et_pb_get_fixed_main_header_height()),
animate_modified=false;
if($this_section.length){
var fullscreen_scroll_duration=800;
$('html, body').animate({ scrollTop:section_bottom }, {
duration: fullscreen_scroll_duration
});
}}
function et_pb_window_load_scripts(){
et_fix_fullscreen_section();
$('section.et_pb_fullscreen').each(function(){
var $this_section=$(this);
$.proxy(et_calc_fullscreen_section, $this_section)();
});
$('.et_pb_fullwidth_header_scroll').on('click', 'a', et_pb_fullwidth_header_scroll);
setTimeout(function(){
$('.et_pb_preload').removeClass('et_pb_preload');
}, 500);
if($.fn.hashchange){
$(window).hashchange(function(){
var hash=window.location.hash.substring(1);
process_et_hashchange(hash);
});
$(window).hashchange();
}
if($et_pb_parallax.length&&!et_is_mobile_device){
$et_pb_parallax.each(function(){
et_pb_parallax_init($(this));
});
}
et_audio_module_set();
window.et_reinit_waypoint_modules();
if($('.et_audio_content').length){
$(window).trigger('resize');
}}
if(window.et_load_event_fired){
et_pb_window_load_scripts();
}else{
$(window).load(function(){
et_pb_window_load_scripts();
});
}
if($('.et_section_specialty').length){
$('.et_section_specialty').each(function(){
var this_row=$(this).find('.et_pb_row');
this_row.find('>.et_pb_column:not(.et_pb_specialty_column)').addClass('et_pb_column_single');
});
}
if($('.et_pb_section_parallax').length&&$('.et_pb_map').length){
$('body').addClass('parallax-map-support');
}
$('.et_pb_widget_area ' + et_pb_custom.widget_search_selector).each(function(){
var $search_wrap=$(this),
$search_input_submit=$search_wrap.find('input[type="submit"]'),
search_input_submit_text=$search_input_submit.attr('value'),
$search_button=$search_wrap.find('button'),
search_button_text=$search_button.text(),
has_submit_button=$search_input_submit.length||$search_button.length ? true:false,
min_column_width=150;
if(! $search_wrap.find('input[type="text"]').length&&! $search_wrap.find('input[type="search"]').length){
return;
}
if(! has_submit_button){
$search_wrap.addClass('et-no-submit-button');
}
if($search_wrap.width() < 150){
$search_wrap.addClass('et-narrow-wrapper');
}
if($search_input_submit.length&&(typeof search_input_submit_text=='undefined'||search_input_submit_text==='')){
$search_input_submit.remove();
$search_wrap.addClass('et-no-submit-button');
}
if($search_button.length&&(typeof search_button_text=='undefined'||search_button_text==='')){
$search_button.remove();
$search_wrap.addClass('et-no-submit-button');
}});
window.et_pb_search_init=function($search){
var $input_field=$search.find('.et_pb_s'),
$button=$search.find('.et_pb_searchsubmit'),
input_padding=$search.hasClass('et_pb_text_align_right') ? 'paddingLeft':'paddingRight',
disabled_button=$search.hasClass('et_pb_hide_search_button');
$button.css({ 'position':'relative' });
if($button.innerHeight() > $input_field.innerHeight()){
$input_field.height($button.innerHeight());
}
if(! disabled_button){
$input_field.css(input_padding, $button.innerWidth() + 10);
}
$button.css({ 'position':'' });
}
window.et_pb_search_percentage_custom_margin_fix=function($search){
var inputMargin=$search.find('.et_pb_s').css('margin').split(' ');
var inputMarginObj={};
switch(inputMargin.length){
case 4:
inputMarginObj={
top: inputMargin[0],
right: inputMargin[1],
bottom: inputMargin[2],
left: inputMargin[3],
};
break;
case 2:
inputMarginObj={
top: inputMargin[0],
right: inputMargin[1],
bottom: inputMargin[0],
left: inputMargin[1],
};
break;
default:
inputMarginObj={
top: inputMargin[0],
right: inputMargin[0],
bottom: inputMargin[0],
left: inputMargin[0],
};
break;
}
var inputRight=0 - parseFloat(inputMarginObj.left) + 'px';
$search.find('.et_pb_searchsubmit').css({
top: inputMarginObj.top,
right: inputRight,
bottom: inputMarginObj.bottom,
});
}
if($('.et_pb_search').length){
$('.et_pb_search').each(function(){
var $search=$(this);
if($search.is('.et_pb_search_percentage_custom_margin')){
et_pb_search_percentage_custom_margin_fix($search);
}
et_pb_search_init($search);
});
}
window.et_pb_comments_init=function($comments_module){
var $comments_module_button=$comments_module.find('.comment-reply-link, .submit');
if($comments_module_button.length){
$comments_module_button.addClass('et_pb_button');
if(typeof $comments_module.attr('data-icon')!=='undefined'&&$comments_module.attr('data-icon')!==''){
$comments_module_button.attr('data-icon', $comments_module.attr('data-icon'));
$comments_module_button.addClass('et_pb_custom_button_icon');
}}
};
if($('.et_pb_comments_module').length){
$('.et_pb_comments_module').each(function(){
var $comments_module=$(this);
et_pb_comments_init($comments_module);
});
}
window.et_fix_pricing_currency_position();
$(document).trigger('et_pb_after_init_modules');
});
}
window.et_pb_debounce=function(func, wait, immediate){
var timeout, args, context, timestamp, result;
var now=Date.now||new Date().getTime();
var later=function(){
var last=now - timestamp;
if(last < wait&&last >=0){
timeout=setTimeout(later, wait - last);
}else{
timeout=null;
if(!immediate){
result=func.apply(context, args);
if(!timeout) context=args=null;
}}
};
return function(){
context=this;
args=arguments;
timestamp=now;
var callNow=immediate&&!timeout;
if(!timeout) timeout=setTimeout(later, wait);
if(callNow){
result=func.apply(context, args);
context=args=null;
}
return result;
};};
if(et_pb_custom.is_ab_testing_active&&'yes'===et_pb_custom.is_cache_plugin_active){
$(window).load(function(){
window.et_load_event_fired=true;
});
$.ajax({
type: "POST",
url: et_pb_custom.ajaxurl,
dataType: "json",
data:
{
action:'et_pb_ab_get_subject_id',
et_frontend_nonce:et_pb_custom.et_frontend_nonce,
et_pb_ab_test_id:et_pb_custom.page_id
},
success: function(subject_data){
if(subject_data){
$('.et_pb_subject_placeholder_id_' + subject_data.id).after(subject_data.content);
$('.et_pb_subject_placeholder').remove();
window.et_pb_init_modules();
$('body').trigger('et_pb_ab_subject_ready');
}}
});
}else{
window.et_pb_init_modules();
}})(jQuery);
jQuery(document).ready(function(){"use strict";var is_ajax_request=false,rated_on_this_page=false,ajax_loader_image_obj=jQuery('.wpbph-ajax-loader'),current_comment_post_id=0;function wpbph_ajax_start(){ajax_loader_image_obj.show().css('display','inline-block');is_ajax_request=true}function wpbph_ajax_stop(){ajax_loader_image_obj.fadeOut(1000);is_ajax_request=false}if(jQuery.isFunction(jQuery.fn.placeholder)){jQuery('input, textarea').placeholder()}if(jQuery.isFunction(jQuery.fn.popover)){jQuery('.wpbph-button-more').popover()}jQuery('.wpbph-frontend button').click(function(event){event.preventDefault()});function is_function(function_to_check){var getType={};return function_to_check&&getType.toString.call(function_to_check)==='[object Function]'}jQuery('.wpbph-button-ok, .wpbph-button-bad, .wpbph-table-big-heart i, .wpbph-heart-small').click(function(event){if(is_ajax_request||rated_on_this_page)return false;var button_pressed=jQuery(this).attr('class');var post_id=jQuery(this).parent().parent().data('post_id');var thisObj=jQuery(this);var preview_mode=thisObj.parent().parent().data('preview_mode');if(1==preview_mode){var preview_current_rating=parseInt(thisObj.parent().parent().parent().find('.wpbph-value-inner').text());if(thisObj.hasClass('wpbph-button-ok')){preview_current_rating=preview_current_rating+1}else{preview_current_rating=preview_current_rating-1}if(preview_current_rating>100){preview_current_rating=100}if(preview_current_rating<0){preview_current_rating=0}var preview_difference=100-preview_current_rating;wpbph_run_up(thisObj.parent().parent().parent().find('.wpbph-value-inner'),0,preview_current_rating,function(){window.setTimeout(function(){jQuery('.wpbph-modal').data('preview_mode',1);jQuery('.wpbph-modal').modal('show');jQuery('.wpbph-modal .wpbph-ajax-loader').hide()},1100)});window.setTimeout(function(){wpbph_run_up(thisObj.parent().parent().parent().find('.wpbph-bad-value-inner'),0,preview_difference)},400);return}if(thisObj.hasClass('wpbph-heart-small'))post_id=thisObj.parent().parent().parent().data('post_id');ajax_loader_image_obj=thisObj.closest('.wpbph-rating').find('.wpbph-ajax-loader');jQuery.ajax({'url':WPBAjaxRating.ajaxurl,'type':'POST','dataType':'json','data':{'action':'wpbph_ajax_rate','post_id':post_id,'button_pressed':button_pressed},'beforeSend':wpbph_ajax_start(),'complete':wpbph_ajax_stop(),'success':function(response){if(0==response.error||1==preview_mode){wpbph_run_up(thisObj.parent().parent().parent().find('.wpbph-value-inner'),0,response.rating_ok,function(){window.setTimeout(function(){jQuery('.wpbph-modal').modal('show');current_comment_post_id=post_id;jQuery('.wpbph-modal .wpbph-ajax-loader').hide()},1100)});window.setTimeout(function(){wpbph_run_up(thisObj.parent().parent().parent().find('.wpbph-bad-value-inner'),0,response.rating_bad)},400);jQuery('.wpbph-button-ok, .wpbph-button-bad').css('cursor','default');rated_on_this_page=true}else if(1==response.error){alert(response.message)}}})});function wpbph_run_up(e,from,to,after_func){var stop=false;to=parseInt(to);from=parseInt(from);e.text(from);if(0==to){if(is_function(after_func))after_func();return}if(to
to)stop=true}if(true==stop){e.css('opacity',0.1);e.animate({'opacity':1},1000);if(is_function(after_func))after_func();return}window.setTimeout(function(){wpbph_run_up(e,from,to,after_func)},10)}jQuery('.wpbph-send-comment').click(function(e){if(1==jQuery('.wpbph-modal').data('preview_mode')){alert('This plugin is in demo mode. Ratings and comments can not be submitted.');jQuery('.wpbph-modal').modal('hide');return}e.preventDefault();if(is_ajax_request)return false;var modalObj=jQuery('.wpbph-modal');var post_id=current_comment_post_id;var comment=modalObj.find('textarea.wpbph-comment').val();var name=modalObj.find('.wpbph-comment-name').val();var email=modalObj.find('.wpbph-comment-email').val();if(0==comment.length){modalObj.modal('hide');return false}ajax_loader_image_obj=jQuery('.wpbph-modal .wpbph-ajax-loader');jQuery.ajax({'url':WPBAjaxRating.ajaxurl,'type':'POST','dataType':'json','data':{'action':'wpbph_ajax_comment','post_id':post_id,'comment':comment,'name':name,'email':email},'beforeSend':wpbph_ajax_start(),'complete':wpbph_ajax_stop(),'success':function(response){if(1==response.error){alert(response.message)}else{modalObj.modal('hide')}}})});jQuery('.wpbph-comment-rating i').click(function(){if(is_ajax_request)return false;var thisObj=jQuery(this);ajax_loader_image_obj=thisObj.parent().find('.wpbph-ajax-loader');if(thisObj.data('rated')==true)return false;var comment_id=thisObj.parent().data('comment_id');var s_class='wpbph-comment-ok';if(thisObj.hasClass('wpbph-comment-bad'))s_class='wpbph-comment-bad';jQuery.ajax({'url':WPBAjaxRating.ajaxurl,'type':'POST','dataType':'json','data':{'action':'wpbph_ajax_rate_comment','comment_id':comment_id,'class':s_class},'beforeSend':wpbph_ajax_start(),'complete':wpbph_ajax_stop(),'success':function(response){if(1==response.error){alert(response.message)}else{wpbph_run_up(thisObj.parent().find('.wpbph-comment-ok span'),0,response.rating_number);thisObj.data('rated',true)}}})});function refresh_ratings(){ajax_loader_image_obj=jQuery('.wpbph-ajax-loader');jQuery.ajax({'url':WPBAjaxRating.ajaxurl,'type':'POST','dataType':'json','data':{'action':'wpbph_ajax_refresh_post_ratings','post_id':WPBAjaxRating.current_post_id},'beforeSend':wpbph_ajax_start(),'complete':wpbph_ajax_stop(),'success':function(response){if(1==response.error){}else{jQuery.each(response.comments,function(id,value){jQuery('#wpbph_post_comment_id_'+id+' span').text(value)});wpbph_run_up(jQuery('.wpbph-value-inner'),0,response.rating_ok);window.setTimeout(function(){wpbph_run_up(jQuery('.wpbph-bad-value-inner'),0,response.rating_bad)},500);resort_comments()}}})}if(WPBAjaxRating.stop_refreshing!=1)refresh_ratings();function Numsort(a,b){return a-b}function resort_comments(){if(1!=WPBAjaxRating.allow_sorting)return}});
+function(a){"use strict";var b=function(b,c){this.options=c,this.$element=a(b),this.$backdrop=this.isShown=null,this.options.remote&&this.$element.load(this.options.remote)};b.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},b.prototype.toggle=function(a){return this[this.isShown?"hide":"show"](a)},b.prototype.show=function(b){var c=this,d=a.Event("show.bs.modal",{relatedTarget:b});this.$element.trigger(d);if(this.isShown||d.isDefaultPrevented())return;this.isShown=!0,this.escape(),this.$element.on("click.dismiss.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.backdrop(function(){var d=a.support.transition&&c.$element.hasClass("fade");c.$element.parent().length||c.$element.appendTo(document.body),c.$element.show(),d&&c.$element[0].offsetWidth,c.$element.addClass("in").attr("aria-hidden",!1),c.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:b});d?c.$element.find(".modal-dialog").one(a.support.transition.end,function(){c.$element.focus().trigger(e)}).emulateTransitionEnd(300):c.$element.focus().trigger(e)})},b.prototype.hide=function(b){b&&b.preventDefault(),b=a.Event("hide.bs.modal"),this.$element.trigger(b);if(!this.isShown||b.isDefaultPrevented())return;this.isShown=!1,this.escape(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").attr("aria-hidden",!0).off("click.dismiss.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one(a.support.transition.end,a.proxy(this.hideModal,this)).emulateTransitionEnd(300):this.hideModal()},b.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(a){this.$element[0]!==a.target&&!this.$element.has(a.target).length&&this.$element.focus()},this))},b.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.bs.modal",a.proxy(function(a){a.which==27&&this.hide()},this)):this.isShown||this.$element.off("keyup.dismiss.bs.modal")},b.prototype.hideModal=function(){var a=this;this.$element.hide(),this.backdrop(function(){a.removeBackdrop(),a.$element.trigger("hidden.bs.modal")})},b.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},b.prototype.backdrop=function(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('').appendTo(document.body),this.$element.on("click.dismiss.modal",a.proxy(function(a){if(a.target!==a.currentTarget)return;this.options.backdrop=="static"?this.$element[0].focus.call(this.$element[0]):this.hide.call(this)},this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in");if(!b)return;e?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,b).emulateTransitionEnd(150):b()):b&&b()};var c=a.fn.modal;a.fn.modal=function(c,d){return this.each(function(){var e=a(this),f=e.data("bs.modal"),g=a.extend({},b.DEFAULTS,e.data(),typeof c=="object"&&c);f||e.data("bs.modal",f=new b(this,g)),typeof c=="string"?f[c](d):g.show&&f.show(d)})},a.fn.modal.Constructor=b,a.fn.modal.noConflict=function(){return a.fn.modal=c,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d=c.attr("href"),e=a(c.attr("data-target")||d&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({remote:!/#/.test(d)&&d},e.data(),c.data());b.preventDefault(),e.modal(f,this).one("hide",function(){c.is(":visible")&&c.focus()})}),a(document).on("show.bs.modal",".modal",function(){a(document.body).addClass("modal-open")}).on("hidden.bs.modal",".modal",function(){a(document.body).removeClass("modal-open")})}(jQuery),+function(a){"use strict";var b=function(a,b){this.type=this.options=this.enabled=this.timeout=this.hoverState=this.$element=null,this.init("tooltip",a,b)};b.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},b.prototype.init=function(b,c,d){this.enabled=!0,this.type=b,this.$element=a(c),this.options=this.getOptions(d);var e=this.options.trigger.split(" ");for(var f=e.length;f--;){var g=e[f];if(g=="click")this.$element.on("click."+this.type,this.options.selector,a.proxy(this.toggle,this));else if(g!="manual"){var h=g=="hover"?"mouseenter":"focus",i=g=="hover"?"mouseleave":"blur";this.$element.on(h+"."+this.type,this.options.selector,a.proxy(this.enter,this)),this.$element.on(i+"."+this.type,this.options.selector,a.proxy(this.leave,this))}}this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.getOptions=function(b){return b=a.extend({},this.getDefaults(),this.$element.data(),b),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},b.prototype.getDelegateOptions=function(){var b={},c=this.getDefaults();return this._options&&a.each(this._options,function(a,d){c[a]!=d&&(b[a]=d)}),b},b.prototype.enter=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);clearTimeout(c.timeout),c.hoverState="in";if(!c.options.delay||!c.options.delay.show)return c.show();c.timeout=setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show)},b.prototype.leave=function(b){var c=b instanceof this.constructor?b:a(b.currentTarget)[this.type](this.getDelegateOptions()).data("bs."+this.type);clearTimeout(c.timeout),c.hoverState="out";if(!c.options.delay||!c.options.delay.hide)return c.hide();c.timeout=setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide)},b.prototype.show=function(){var b=a.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(b);if(b.isDefaultPrevented())return;var c=this.tip();this.setContent(),this.options.animation&&c.addClass("fade");var d=typeof this.options.placement=="function"?this.options.placement.call(this,c[0],this.$element[0]):this.options.placement,e=/\s?auto?\s?/i,f=e.test(d);f&&(d=d.replace(e,"")||"top"),c.detach().css({top:0,left:0,display:"block"}).addClass(d),this.options.container?c.appendTo(this.options.container):c.insertAfter(this.$element);var g=this.getPosition(),h=c[0].offsetWidth,i=c[0].offsetHeight;if(f){var j=this.$element.parent(),k=d,l=document.documentElement.scrollTop||document.body.scrollTop,m=this.options.container=="body"?window.innerWidth:j.outerWidth(),n=this.options.container=="body"?window.innerHeight:j.outerHeight(),o=this.options.container=="body"?0:j.offset().left;d=d=="bottom"&&g.top+g.height+i-l>n?"top":d=="top"&&g.top-l-i<0?"bottom":d=="right"&&g.right+h>m?"left":d=="left"&&g.left-h'}),b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype),b.prototype.constructor=b,b.prototype.getDefaults=function(){return b.DEFAULTS},b.prototype.setContent=function(){var a=this.tip(),b=this.getTitle(),c=this.getContent();a.find(".popover-title")[this.options.html?"html":"text"](b),a.find(".popover-content")[this.options.html?"html":"text"](c),a.removeClass("fade top bottom left right in"),a.find(".popover-title").html()||a.find(".popover-title").hide()},b.prototype.hasContent=function(){return this.getTitle()||this.getContent()},b.prototype.getContent=function(){var a=this.$element,b=this.options;return a.attr("data-content")||(typeof b.content=="function"?b.content.call(a[0]):b.content)},b.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")},b.prototype.tip=function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip};var c=a.fn.popover;a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("bs.popover"),f=typeof c=="object"&&c;e||d.data("bs.popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.noConflict=function(){return a.fn.popover=c,this}}(jQuery);
!function(a,b){"use strict";function c(){if(!e){e=!0;var a,c,d,f,g=-1!==navigator.appVersion.indexOf("MSIE 10"),h=!!navigator.userAgent.match(/Trident.*rv:11\./),i=b.querySelectorAll("iframe.wp-embedded-content");for(c=0;c