var _ready=function(){
	Array.prototype.forEach.call(document.querySelectorAll('[data-lib="59024"]'),function(element){	const accordion = element.getElementsByClassName('-w-accordion');
const accordionMenu = element.getElementsByClassName('-w-accordion_menu');
const accordionSubmenu = element.getElementsByClassName('-w-accordion_submenu');
const h1 = element.querySelector('.-w-h1-wrap');

let isOpen = [];
const uuids = [
  '[data-lib-uuid="a865a615-b97a-41ea-a57a-99e51176aedd"]',
  '[data-lib-uuid="8da4e59a-6bab-4a79-9507-e605de8ffae9"]',
  '[data-lib-uuid="dc2c7bbf-cdc4-4e6d-9cd6-879da3b1af1b"]'
  ];
let isExist = false;

uuids.forEach(function(element){
  const node = document.querySelectorAll(element);
  if(node.length > 0){
    isExist = true;
  }
});

if(!isExist && h1!=undefined){
  h1.classList.add('-w-clr_rev');
}

//サブメニューがある時は左に余白をつける
if(accordionSubmenu.length > 0){
    for(let h=0; h<accordionMenu.length; h++){
        accordionMenu[h].classList.add('-w-padding_active');
    }
}

for(let i = 0; i < accordionSubmenu.length; i++ ) {

    const index = i; //IEのため必要

    isOpen[index] = false;

    accordion[index].addEventListener('click', function(e) {
    
        accordion[index].classList.toggle('-w-active');
        accordionSubmenu[index].classList.toggle('-w-active');

        const lists = accordionSubmenu[index].getElementsByTagName('li');

        if(isOpen[index] == false) {
            for (let j = 0; j < lists.length; j++){
                lists[j].style.transitionDelay = "0s";
            }
            const idx = i;

            calcHeight(index);
            accordionSubmenu[index].classList.remove('-w-heightzero');

            isOpen[index] = true;
        }
        else{

            for (let j = lists.length - 1; j >= 0; j--){
                lists[j].style.transitionDelay = (lists.length - j)*0.01+"s";
            }
            accordionSubmenu[index].classList.add('-w-heightzero');
            accordionSubmenu[index].classList.remove('-w-transition_zero');

            isOpen[index] = false;
        }
    }, false);
}

//ウインドウリサイズでサブメニューの高さを再計算
window.addEventListener('resize', function() {

    for(i = 0; i<accordionSubmenu.length; i++){

        if(isOpen.length == 0 || !isOpen[i]){return;}

        accordionSubmenu[i].classList.add('-w-transition_zero');
        calcHeight(i);
    }
}, false );

//ここまで

//スクロールでクラス追加
window.addEventListener('scroll', function(){
    var y = window.pageYOffset ;
    var target = document.getElementById('-w-header');
    if(y>400){
    	target.classList.add("fixed");
    } else {
		target.classList.remove("fixed");
	}
});

//ここから
//サブメニュー高さ計算
function calcHeight(index){

    const lists = accordionSubmenu[index].getElementsByTagName('li');
    let listheights = 0;

    for(let j = 0; j<lists.length; j++){
        listheights = listheights + 28 + lists[j].clientHeight;
    }

    accordionSubmenu[index].style.maxheight = listheights + "px";
}

// RWDメニューオープンクローズ
const sp_bt = Array.from(element.querySelectorAll('#navcheck'));
const target = Array.from(element.querySelectorAll('#target'));

sp_bt[0].addEventListener('click',function(){
    target[0].classList.toggle('-w-is-open');

});



});Array.prototype.forEach.call(document.querySelectorAll('[data-lib="37289"]'),function(element){	const video = element.getElementsByTagName('video')[0];

if (video) {
    window.setTimeout(function(){
        var video_promise=video.play();
        if (video_promise !== undefined) {
            video_promise.then(function() {
                const loading = element.querySelector('.-w-mv_loading');
                loading ? loading.classList.add('-w-mv_loading_done'):'';
            }).catch(function(error) {
                setTimeout(() => {
                    const loading = element.querySelector('.-w-mv_loading');
                    loading ? loading.classList.add('-w-mv_loading_done'):'';
                }, 2000);
            });
        }else{
            setTimeout(() => {
                const loading = element.querySelector('.-w-mv_loading');
                loading ? loading.classList.add('-w-mv_loading_done'):'';
            }, 2000);
        }
        const catchL = element.querySelector('.-w-catch_L');
        const catchM = element.querySelector('.-w-catch_M');
        catchL ? catchL.classList.add('-w-animation_L'):'';
        catchM ? catchM.classList.add('-w-animation_M'):'';
    }, 300);
}


});Array.prototype.forEach.call(document.querySelectorAll('[data-lib="59410"]'),function(element){	//var mySwiper = new Swiper(element.querySelector('.swiper_service'), {
//	effect: 'coverflow',
//	slidesPerView: 1,
//	autoplay: {
//		delay: 3000,
//		stopOnLastSlide: false,
//		disableOnInteraction: false,
//		reverseDirection: false
//	},
//	navigation: {
//		nextEl: element.querySelector('.swiper-button-next'),
//		prevEl: element.querySelector('.swiper-button-prev')
//	},
//	pagination: {
//		el: '.swiper-pagination',
//		type: 'bullets',
//		clickable: true
//	}
//});
//console.log(element.clientHeight);
//window.addEventListener("scroll",function(){
//    var e=element.querySelectorAll('.image');for(i=0;i<e.length;i++){e[i].getBoundingClientRect().top<1000&&e[i].classList.add("-w-active");}
//    });

window.addEventListener("scroll",function(){var e=element.getElementsByClassName("fade");for(i=0;i<e.length;i++){e[i].getBoundingClientRect().top<600&&e[i].classList.add("on")}});
});Array.prototype.forEach.call(document.querySelectorAll('[data-lib="59133"]'),function(element){	window.addEventListener("scroll",function(){
    var e=element.querySelectorAll('.fade');for(i=0;i<e.length;i++){e[i].getBoundingClientRect().top<1000&&e[i].classList.add("on")}
    console.log(e);
    });
});Array.prototype.forEach.call(document.querySelectorAll('[data-lib="59333"]'),function(element){	window.addEventListener("scroll",function(){
    var e=element.querySelectorAll('.-w-easing');for(i=0;i<e.length;i++){e[i].getBoundingClientRect().top<1000&&e[i].classList.add("-w-active");}
    });
});Array.prototype.forEach.call(document.querySelectorAll('[data-lib="59192"]'),function(element){	function showElementAnimation() {

  var fade = element.getElementsByClassName('-w-anima-fade');
  if(!fade) return;

  var showTiming = window.innerHeight > 768 ? 200 : 40;
  var scrollY = window.pageYOffset;
  var windowH = window.innerHeight;

  for(var i=0;i<fade.length;i++) { var elemClientRect = fade[i].getBoundingClientRect(); var elemY = scrollY + elemClientRect.top; if(scrollY + windowH - showTiming > elemY) {
      fade[i].classList.add('-w-is-show');
    } else if(scrollY + windowH < elemY) {
      fade[i].classList.remove('-w-is-show');
    }
  }

}
showElementAnimation();
window.addEventListener('scroll', showElementAnimation);

});Array.prototype.forEach.call(document.querySelectorAll('[data-lib="59232"]'),function(element){	function showElementAnimation() {

  var fade = element.getElementsByClassName('-w-anima-fade');
  if(!fade) return;

  var showTiming = window.innerHeight > 768 ? 200 : 40;
  var scrollY = window.pageYOffset;
  var windowH = window.innerHeight;

  for(var i=0;i<fade.length;i++) { var elemClientRect = fade[i].getBoundingClientRect(); var elemY = scrollY + elemClientRect.top; if(scrollY + windowH - showTiming > elemY) {
      fade[i].classList.add('-w-is-show');
    } else if(scrollY + windowH < elemY) {
      fade[i].classList.remove('-w-is-show');
    }
  }

}
showElementAnimation();
window.addEventListener('scroll', showElementAnimation);
});Array.prototype.forEach.call(document.querySelectorAll('[data-lib="58991"]'),function(element){	const box = element.getElementsByClassName('-w-matchHeight');

window.addEventListener('load', (event) => {
    setBoxHeight();
});

function setBoxHeight(){
    
    if(!box){return;}
    
    let maxHeight = 0;
    
    for(let i=0;i<box.length;i++){
        const height = box[i].offsetHeight;
        if(height > maxHeight){
            maxHeight = height;
        }
    }
    
    for(let j=0;j<box.length;j++){
        box[j].style.height = maxHeight + "px";
    }
}

function resetBoxHeight(){
    
    if(!box){return;}
    
    for(let j=0;j<box.length;j++){
        box[j].style.height = "auto";
    }
}

window.addEventListener( 'resize', function() {
    setTimeout(function(){
        resetBoxHeight();
        setBoxHeight();
    }, 300);
}, false );
});Array.prototype.forEach.call(document.querySelectorAll('[data-lib="59399"]'),function(element){	let setTimeoutId;
const container = element.getElementsByClassName('-w-container');
const underbtn = element.getElementsByClassName('-w-underbtn');
let count = underbtn.length;


// '-w-list' の要素の数をカウント
const listElements = element.querySelectorAll('.-w-list');
const x = listElements.length;

// '-w-inner' の要素の grid-template-columns プロパティを設定
const innerElements = element.querySelectorAll('.-w-inner');
innerElements.forEach(innerElement => {
    innerElement.style.gridTemplateColumns = `repeat(${x}, 1fr)`;
});


//ページ読み込み時とスクロール時のフッター追従の表示

const displayOnFirstView = true; // TOP FVでの表示を切り替え（true / false）

function addFooterAppearance() {
    setTimeout(() => {
      container[0].classList.add('-w-appear');
    }, 800); // 0.8秒後に付与
}
function removeFooterAppearance() {
    container[0].classList.remove('-w-appear');
}

window.addEventListener("load", function() {
    removeFooterAppearance(); // ページ読み込み時は非表示
    if (displayOnFirstView) {
      addFooterAppearance();
    } else if (window.scrollY > 100 || element.dataset.toppage == 'false') {
      addFooterAppearance();
    }
});

window.addEventListener("scroll", function() {
    clearTimeout(setTimeoutId);
    removeFooterAppearance();

    setTimeoutId = setTimeout(function() {
        if (displayOnFirstView) {
          addFooterAppearance();
        } else if (window.scrollY > 100 || element.dataset.toppage == 'false') { // ここでスクロール量を指定
            addFooterAppearance();
        } else {
            removeFooterAppearance();
        }
    }, 100);
});

});Array.prototype.forEach.call(document.querySelectorAll('[data-lib="58793"]'),function(element){	const origin = window.location.origin;
const url = window.location.href;
const dirname = url.replace(origin,'');

let statePushedCount = 0;
let isShown = false; // ← 1回だけ出す用の制御フラグ
const dialog = document.querySelector('.-w-modal-alert');

// ★ ここで -w-modal-dialog が存在しない場合は処理中止
if (!dialog || !dialog.querySelector('.-w-modal-dialog')) return;

const LINK_STATE = {
  externalLink: {
    lastClicked: null,
    clickCount: 0
  }
};

document.body.click();

// 履歴スタックを積む（戻るでモーダルを出すため）
document.addEventListener("click", () => {
  if (!isShown) {
    history.pushState(null, null, null);
    statePushedCount += 1;
  }
});

document.addEventListener("touchstart", () => {
  if (!isShown && statePushedCount < 2) {
    history.pushState(null, null, null);
    statePushedCount += 1;
  }
});

// モーダルを閉じる（共通関数）
function hideModal() {
  dialog.classList.add('-w-d_none');
  dialog.classList.remove('show-up');
  isShown = true;

  if (statePushedCount > 0) {
    history.back();
    statePushedCount--;
  }
}

// Esc キーでモーダルを閉じる
document.addEventListener('keydown', (e) => {
  if (e.key === 'Escape' && !dialog.classList.contains('-w-d_none')) {
    e.preventDefault();
    hideModal();
  }
}, { passive: false });

// 戻るボタンでモーダルを表示（1回だけ）
window.addEventListener("popstate", () => {
  const h = location.hash;
  if (h || isShown) return;

  dialog.classList.remove('-w-d_none');
  dialog.classList.add('show-up');
  isShown = true;
});

// <main>の直下要素かどうか判定
function isInMainChild(link) {
  const main = document.querySelector('main');
  if (!main) return false;
  let parent = link.parentElement;
  while (parent && parent !== document.body) {
    if (parent.parentElement === main) return true;
    parent = parent.parentElement;
  }
  return false;
}

// モーダルを閉じるボタン処理
function manipulateModal(){
  const closebtn = dialog.querySelector('.close');
  if (closebtn) {
    closebtn.addEventListener('click', hideModal);
  }
}

// モーダル対象リンクかを判定
function shouldHandleLink(link, currentUrl, linkScope) {
  try {
    const linkUrl = new URL(link.href, location.href);
    const isSamePage = (
      linkUrl.origin + linkUrl.pathname + linkUrl.search ===
      currentUrl.origin + currentUrl.pathname + currentUrl.search
    );

    const isInternal = linkUrl.origin === currentUrl.origin;
    const isExternal = !isInternal;
    const inMainChild = isInMainChild(link);
    if (inMainChild) return false;

    if (linkScope === 'off') return false;
    if (linkScope === 'internal') return isInternal && !isSamePage;
    if (linkScope === 'external') return isExternal;
    if (linkScope === 'both') return !isSamePage && (isInternal || isExternal);
    return false;
  } catch {
    return false;
  }
}

// リンクごとのモーダル制御（1回目クリックでモーダル、2回目で遷移）
function clickAnchorEvent() {
  const links = document.querySelectorAll('a');
  const currentUrl = new URL(location.href);
  const scopeElement = document.querySelector('[data-link-scope]');
  const linkScope = scopeElement?.dataset.linkScope || 'both';

  links.forEach(link => {
    if (!(link instanceof HTMLAnchorElement)) return;
    if (link.href.startsWith('tel:')) return;
    if (link.closest('.-w-modal')) return;

    if (!shouldHandleLink(link, currentUrl, linkScope)) return;

    const handleClick = function(event) {
      if (event.target.classList && event.target.classList.contains('-w-modal_image_anchor')) return;

      const alreadyClicked = LINK_STATE.externalLink.lastClicked === link && LINK_STATE.externalLink.clickCount > 0;
      const openInNewTab = link.target === '_blank';

      if (!alreadyClicked) {
        event.preventDefault();
        event.stopPropagation();
        dialog.classList.remove('-w-d_none');
        dialog.classList.add('show-up');
        LINK_STATE.externalLink.lastClicked = link;
        LINK_STATE.externalLink.clickCount = 1;
      } else {
        LINK_STATE.externalLink.lastClicked = null;
        LINK_STATE.externalLink.clickCount = 0;

        if (openInNewTab) {
          window.open(link.href, '_blank');
        } else {
          window.location.href = link.href;
        }
      }
    };

    link.addEventListener('click', handleClick, { passive: false });
  });
}

manipulateModal();
clickAnchorEvent();
});/*layout:25*/
let header = document.getElementsByTagName("header");
let headerHeight = 0;

if (header[0]) {
  headerHeight = header[0].offsetHeight;
  if (headerHeight === 0) {
    headerHeight = header[0].children[0].offsetHeight;
  }
}

const scrollElm = (function () {
  if ("scrollingElement" in document) return document.scrollingElement;
  if (navigator.userAgent.indexOf("WebKit") != -1) return document.body;
  return document.documentElement;
})();

(function () {
  const duration = 800;
  const ignore = ".noscroll";
  const easing = function (t, b, c, d) {
    return c * (0.5 - Math.cos((t / d) * Math.PI) / 2) + b;
  }; //jswing
  const smoothScrollElm = document.querySelectorAll(
    'a[href^="#"]:not(' + ignore + ")"
  );
  Array.prototype.forEach.call(smoothScrollElm, function (elm) {
    elm.addEventListener("click", function (e) {
      e.preventDefault();
      const targetElm = document.querySelector(elm.getAttribute("href"));
      if (!targetElm) return;
      const targetPos =
        targetElm.getBoundingClientRect().top - headerHeight - 20;
      const startTime = Date.now();
      const scrollFrom = scrollElm.scrollTop;
      (function loop() {
        const currentTime = Date.now() - startTime;
        if (currentTime < duration) {
          scrollTo(0, easing(currentTime, scrollFrom, targetPos, duration));
          window.requestAnimationFrame(loop);
        } else {
          scrollTo(0, targetPos + scrollFrom);
        }
      })();
    });
  });
})();

if (header[0] && location.hash) {
  setTimeout(function () {
    window.scrollBy(0, -(header[0].offsetHeight + 80));
  }, 0);
}

function multiLang(header){

  if(!header[0]){
    return;
  }
  
  let userLang = (navigator.language) ? navigator.language : navigator.userLanguage;
  
  const dict = new Set(["is","ay","ga","az","as","af","am","ar","sq","hy","it","yi","ig","ilo","id","ug","cy","uk","uz","ur","ee","et","eo","nl","or","om","kk","ca","gl","kn","rw","el","ky","gn","gu","km","kri","ku","ckb","hr","qu","xh","co","gom","sm","sa","jw","ka","sn","sd","si","sv","zu","gd","es","sk","sl","sw","su","ceb","nso","sr","st","so","th","tl","tg","tt","ta","cs","ny","ts","ti","dv","te","da","de","ak","doi","tk","tr","ne","no","ht","ha","ps","eu","haw","hu","pa","bm","hi","fi","fr","fy","bg","vi","iw","be","fa","bn","bho","pl","bs","pt","mai","mi","mk","mr","mg","ml","mt","ms","lus","my","mni-Mtei","mn","hmn","yo","lo","la","lv","lt","ln","ro","lg","lb","ru","en","ko","zh-CN","zh-TW"]);
  
  if(userLang === undefined){
    userLang = 'ja';
  }
  //zh-TWの時はzh-TW,それ以外の中国語はzh-CH
  else if(userLang.indexOf('zh') > -1){
    if(userLang != 'zh-TW'){
      userLang = 'zh-CN'
    }
  }else if(userLang == "mni-Mtei"){
    userLang = "mni-Mtei"; //メイテイ語（マニプリ語）
  }else if(userLang.indexOf('he') == 0){
    userLang = "iw"; //ヘブライ語
  }else if(userLang.indexOf('jv') == 0){
    userLang = "jw"; //ジャワ語
  }else if(userLang.indexOf('tw') == 0){
    userLang = "ak"; //トゥイ語
  }else if(userLang.indexOf('nn') == 0 || userLang.indexOf('nb') == 0){
    userLang = "no"; //ノルウェー語
  }else if(userLang.indexOf('mo') == 0){
    userLang = "ro"; //ルーマニア語(モルドバ)
  }else if(userLang.indexOf('kok') == 0){
    userLang = "gom"; //コンカニ語
  }else{
    userLang = userLang.split('-')[0].toLowerCase();
  }
  
  if(!dict.has(userLang)){
    userLang = "ja";
  }
  
  let select = document.querySelector('header .goog-te-combo');
  
  // iframe追加の監視を開始
  if(userLang != "ja"){
    changeTranslationLanguage(userLang);
  }
  
  //読み込み時に端末の言語設定にGoogle翻訳を切り替え
  function changeTranslationLanguage(languageCode) {
    
      if(languageCode == 'ja'){return;}
      
      const MAX_RETRIES = 10;
      
      let success = false;
      
      for(let i=0;i<MAX_RETRIES;i++){
        
        if (select) {
          select.value = languageCode;
          success = select.dispatchEvent(new Event('change'));
        }else{
          select = document.querySelector('header .goog-te-combo');
        }
        if(success){
          break;
        }
      }
  }
  
  function getCookie(name) {
      var nameEQ = name + "=";
      var ca = document.cookie.split(';');
      for(var i=0; i < ca.length; i++) {
          var c = ca[i];
          while (c.charAt(0) === ' ') c = c.substring(1, c.length);
          if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
      }
      return 'auto';
  }
  
  function setCookie(name, value, days) {
      var expires = "";
      if (days) {
          var date = new Date();
          date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
          expires = "; expires=" + date.toUTCString();
      }
      document.cookie = name + "=" + (value || "") + expires + "; path=/";
  }
  
  const currentLang = getCookie('googtrans');
  
  setCookie('googtrans', '/'+ currentLang +'/' + userLang, 1);
}

multiLang(header);
	/*page*/
	
};
if (document.readyState !== 'loading') {
	_ready();
} else {
	document.addEventListener('DOMContentLoaded', _ready, false);
}