// JavaScript Document
var scrollpos;
var time = 7000;
var fade = 1000;
var selectel;
$(function() {
$("#pagetop span").click(function() {
$('body,html').animate({scrollTop:0}, 500, 'swing');
return false;
});
$("#menu-item-117,#menu-item-50,#menu-item-51,#menu-item-44").matchHeight();
$("#contents .contents .list ul li .text").matchHeight();
if( $('#mw_wp_form_mw-wp-form-84').length ){
$('#mw_wp_form_mw-wp-form-84 td span.mwform-zip-field input:nth-child(1)').attr('id','zip');
$('#mw_wp_form_mw-wp-form-84 td span.mwform-zip-field input:nth-child(2)').attr('id','zip1');
}
if($(".slide")[0]){
$('.slide .slide1').slick({
slidesToShow: 1,
slidesToScroll: 1,
//arrows: false,
//fade: true,
pauseOnHover: false,
asNavFor: '.slide .slide2'
});
$('.slide .slide2').slick({
slidesToShow: 12,
asNavFor: '.slide .slide1',
centerMode: true,
focusOnSelect: true,
arrows: false,
variableWidth: true
});
}
headsize();
var clen = $("#contents table#wp-calendar tbody tr").length;
var i = 1;
var td;
var cals = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];
var cols = $("#contents #wp-calendar tbody tr:nth-child(1) td:nth-child(1)").attr("colspan");
var num = 0;
if(cols != void 0){
num = Number(cols) - 1;
}
//alert(num);
//alert($("#contents #wp-calendar tbody tr:nth-child(5) td:nth-child(4)").html());
if(num < 4){
td = $("#contents #wp-calendar tbody tr:nth-child(1) td:nth-child("+(5-num)+")");
td.css("background","#FFF7AB");
}
for(i=2; i<=clen; i++){
td = $("#contents #wp-calendar tbody tr:nth-child("+i+") td:nth-child(5)");
//alert(td.text());
if(cals.indexOf(Number(td.text())) >= 0){
td.css("background","#FFF7AB");
}
}
//日曜日
if($("#contents #wp-calendar tbody tr:nth-child(1) td:nth-child(1)").text() == "1"){
$("#contents #wp-calendar tbody tr:nth-child(2) td:nth-child(1)").css("background","#FFF7AB");
}else{
$("#contents #wp-calendar tbody tr:nth-child(3) td:nth-child(1)").css("background","#FFF7AB");
}
//水曜日
if(num < 3){
$("#contents #wp-calendar tbody tr:nth-child(4) td:nth-child(4)").css("background","#FFF7AB");
}else{
$("#contents #wp-calendar tbody tr:nth-child(5) td:nth-child(4)").css("background","#FFF7AB");
}
/*
#contents #wp-calendar tbody tr td:nth-child(4),
#contents #wp-calendar tbody tr:nth-child(2) td:nth-child(7) {
background:#FFF7AB;
}
*/
});
$(window).load(function(){
headsize();
movepos();
$("main").addClass("onn");
});
$(window).resize(function () {
headsize();
});
$(window).scroll(function () {
headsize();
});
$(window).on('orientationchange', function(){
headsize();
});
function headsize(){
var hsize = $("#head").outerHeight()+20;
if(!$("#mainimg")[0]){
$("#main").css({"margin-top":hsize+"px", "background-position":"center "+(hsize+20)+"px"});
}
if(($("body").css("background-size") == "cover") && $("#mainimg")[0]) {
$("#header #logo").css("top",$("#header p").outerHeight() + "px");
var hsize = $("#header p").outerHeight() + $("#header #logo").outerHeight() + 20;
$("#header").css("padding-top",hsize + "px");
}else{
$("#header, #header #logo").removeAttr("style");
}
if($("body").css("background-size") == "cover") {
$("button#responsive-menu-button").css("top",($("#header p").outerHeight() + 5) + "px");
}else{
$("button#responsive-menu-button").removeAttr("style");
}
}
function gotop(){
$('body,html').animate({scrollTop:0}, 0, 'swing');
return false;
}
//他ページよりのアンカーリンク
function movepos(){
var mrg = $("#head").outerHeight();
var href = location.href;
if(href.indexOf("#")>=0){
var href=href.substring(href.indexOf("#")+1,href.length);
}else{
return false;
}
var position = $("#"+href).offset().top;
var speed = 500;
$('body,html').animate({scrollTop:position-mrg}, speed, 'easeInOutQuint');
return false;
}