jQuery(document).ready(function($){
$('form[id$="_scheduler"] input[name^="attmgr_off"]').on('click', function(){
var name=$(this).attr('name').replace(/off/g, 'post');
var target='select[name^="' + name + '"]';
if($(this).prop('checked')){
$(target).attr('disabled', 'disabled');
}else{
$(target).removeAttr('disabled');
}})
var list=new Array();
$('form[id$="_scheduler"] select[name$="starttime]"]').eq(0).children().each(function(){
list.push({ value: $(this).val(), text: $(this).text() });
});
$('form[id$="_scheduler"] select[name$="endtime]"]').each(function(){
var name=$(this).attr('name');
var endtime='select[name="' + name + '"]';
var starttime=endtime.replace(/endtime/g, 'starttime');
var selected=$(endtime + ' option:selected').val();
if($(starttime).val()!=''){
$(endtime).children().remove();
$.each(list, function(key, obj){
if(obj['value'] > $(starttime).val()){
$(endtime).append($('<option>').val(obj['value']).text(obj['text']));
}});
if(selected!=''){
$(endtime + ' option[value="' + selected + '"]').prop('selected', true);
}else{
$(endtime).prepend($('<option>').val('').text(''));
$(endtime + ' option:first-child').prop('selected', true);
}}
});
$('form[id$="_scheduler"] select[name$="starttime]"]').on('change', function(){
var starttime=$(this);
var name=starttime.attr('name').replace(/starttime/g, 'endtime');
var endtime='select[name="' + name + '"]';
var selected=$(endtime + ' option:selected').val();
$(endtime).children().remove();
$.each(list, function(key, obj){
if(obj['value'] > starttime.val()){
$(endtime).append($('<option>').val(obj['value']).text(obj['text']));
}});
if(selected==''){
$(endtime + ' option:last-child').prop('selected', true);
}else if($(endtime + ' option[value="' + selected + '"]').length==0){
$(endtime + ' option:first-child').prop('selected', true);
}else{
$(endtime + ' option[value="' + selected + '"]').prop('selected', true);
}})
$('form[id$="_scheduler"] select[name$="endtime]"]').on('change', function(){
var endtime=$(this);
var name=endtime.attr('name').replace(/endtime/g, 'starttime');
var starttime='select[name="' + name + '"]';
var end_selected=endtime.val();
var start_selected=$(starttime + ' option:selected').val();
if(end_selected!=''&&start_selected==''){
$(starttime + ' option').eq(1).prop('selected', true);
}})
});
jQuery(document).ready(function(e){var s="is-active",t=e("#js-header");t.hasClass("l-header--fixed")&&e(window).scroll(function(){e(window).scrollTop()>0?t.addClass("is-active"):t.removeClass("is-active")}),e("#js-menu-btn").click(function(s){s.preventDefault(),e(this).toggleClass("is-active"),e("#js-global-nav").slideToggle()}),e(".sub-menu-toggle").click(function(){return e(this).toggleClass("is-active").parent("a").next(".sub-menu").slideToggle(),!1}),e("#js-blog-slider__inner").length&&e("#js-blog-slider__inner").slick({autoplay:!0,infinite:!0,slidesToShow:3,responsive:[{breakpoint:992,settings:{arrows:!1}},{breakpoint:768,settings:{arrows:!1,slidesToShow:2}}]});var a=e("#js-pagetop");if(e(window).scroll(function(){e(window).scrollTop()>100?a.addClass("is-active"):a.removeClass("is-active")}),a.click(function(s){e("body, html").animate({scrollTop:0},1e3),s.preventDefault()}),e(".p-tab-panel").length&&e(".p-tab-panel").each(function(){var s=e(this);e(".p-tab-panel__tab-item:first",s).addClass("is-active"),e(".p-tab-panel__tab a",s).click(function(t){e(this).parent().hasClass("is-active")||(e(".is-active",s).removeClass("is-active"),e(this).parent().addClass("is-active"),e(".p-tab-panel__panel",s).hide(),e(e(this).attr("href")).show()),t.preventDefault()})}),e(".p-dropdown").length&&e(".p-dropdown__title").click(function(){e(this).toggleClass("is-active"),e("+ .p-dropdown__list:not(:animated)",this).slideToggle()}),e("#js-comment__tab").length){var i=e("#js-comment__tab");i.find("a").click(function(t){t.preventDefault(),e(this).parent().hasClass(s)||(e(e(".is-active a",i).attr("href")).animate({opacity:"hide"},0),e(".is-active",i).removeClass(s),e(this).parent().addClass(s),e(e(this).attr("href")).animate({opacity:"show"},1e3))})}e("#js-style-gallery-slider").length&&e("#js-style-gallery-nav .p-style__gallery-nav-img").click(function(){var s=e(this).index();e("#js-style-gallery-slider").slick("slickGoTo",parseInt(s))})
var searchWidgets=document.querySelectorAll('.widget_search #searchsubmit, .google_search #searchsubmit');
searchWidgets.forEach(function(searchWidget){
var wrapper=document.createElement('div');
wrapper.className='submit_button';
searchWidget.parentNode.insertBefore(wrapper, searchWidget);
wrapper.appendChild(searchWidget);
});
var calendarCells=document.querySelectorAll('.wp-calendar-table td');
calendarCells.forEach(function(cell){
if(cell.children.length===0){
cell.classList.add('no_link');
var span=document.createElement('span');
while (cell.firstChild){
span.appendChild(cell.firstChild);
}
cell.appendChild(span);
}else{
cell.classList.add('has_link');
}});
var textWidgets=document.querySelectorAll('.widget_text .textwidget');
textWidgets.forEach(function(textWidget){
textWidget.classList.add('p-entry__body');
});
var archiveSelects=document.querySelectorAll('.widget_archive select');
archiveSelects.forEach(function(select){
var wrapper=document.createElement('div');
wrapper.className='select_wrap';
select.parentNode.insertBefore(wrapper, select);
wrapper.appendChild(select);
});
var categoryForms=document.querySelectorAll('.widget_categories form');
categoryForms.forEach(function(form){
var wrapper=document.createElement('div');
wrapper.className='select_wrap';
form.parentNode.insertBefore(wrapper, form);
wrapper.appendChild(form);
});
});