/* sample01
======================================== */
$(function() {
	var nav = $('.overimg');
	nav.hover(
		function(){
			$(this).fadeTo(300,0.5);
		},
		function () {
			$(this).fadeTo(300,1);
		}
	);
});


$(function() {
	$(window).scroll(function () {
		var s = $(this).scrollTop();
		var m = 100;
		if(s > m) {
			$("#m_navi_btn").fadeIn('slow');
		} else if(s < m) {
			$("#m_navi_btn").fadeOut('slow');
		}
	});
});


$(function(){
    var setImg = '#top_img_box';
    var fadeSpeed = 3000;//フェイドが完了する時間
    var switchDelay = 6000;//画像の切り替えする時間
 
    $(setImg).children('img').css({opacity:'0'});
    $(setImg + ' img:first').stop().animate({opacity:'1',zIndex:'20'},fadeSpeed);
 
    setInterval(function(){
        $(setImg + ' :first-child').animate({opacity:'0'},fadeSpeed).next('img').animate({opacity:'1'},fadeSpeed).end().appendTo(setImg);
    },switchDelay);
});



$(function(){
   // #で始まるアンカーをクリックした場合に処理
   $('a[href^=#s]').click(function() {
      // スクロールの速度
      var speed = 700; // ミリ秒
      // アンカーの値取得
      var href= $(this).attr("href");
      // 移動先を取得
      var target = $(href == "#" || href == "" ? 'html' : href);
      // 移動先を数値で取得
      var position = target.offset().top - 90;
      // スムーススクロール
      $('body,html').animate({scrollTop:position}, speed, 'swing');
      return false;
   });
});


$(function() {
    $(".header_navi").css("display","none");
    $(".menu_on").on("click", function() {
        $(".header_navi").slideToggle();
    });
});
        $(function(){
            $('.menu_btn').on('click', function(event){
                event.preventDefault();
                $(this).toggleClass('active');
            });
        });



$(window).on('load', function() {
 var url = $(location).attr('href');
 if(url.indexOf("#") != -1){
 var anchor = url.split("#");
 var target = $('#' + anchor[anchor.length - 1]);
 if(target.length){
 var pos = Math.floor(target.offset().top) - 110;
 $("html, body").animate({scrollTop:pos}, 500);
 }
 }
 });

$(function(){
    $(window).scroll(function() {
	var windowWidth = $(window).width();

        //if ($(this).scrollTop() >= 0 && $(this).scrollTop() < 100) {
	if(windowWidth > 767){
        if ($(this).scrollTop() > 60) {
        if ($(this).scrollTop() < 100) {
	$('header').hide().fadeIn(500);
	}
            $('header').css('margin-top', '0'); /* htmlファイルのnavタグの背景色変更 */
	}else{
            $('header').css('margin-top', '50px'); /* htmlファイルのnavタグの背景色変更 */
	}
	}else{
        if ($(this).scrollTop() > 60) {
        if ($(this).scrollTop() < 100) {
	$('header').hide().fadeIn(500);
	}
            $('header').css('margin-top', '0'); /* htmlファイルのnavタグの背景色変更 */
	}else{
            $('header').css('margin-top', '5%'); /* htmlファイルのnavタグの背景色変更 */
	}
}
    });
});
    function openMenu(n) {            //リストを開く
        closeMenu()            //表示中のリストを閉じる
        if(n == 1) {            //リスト１を開く
            li1.style.display = "block";
        }
        else if(n == 2) {        //リスト２を開く
            li2.style.display = "block";
        }
        else if(n == 3) {        //リスト３を開く
            li3.style.display = "block";
        }
    }
    function closeMenu() {            //リストを閉じる
        li1.style.display = "none";
        li2.style.display = "none";
        li3.style.display = "none";
    }


$(function() {
	// 初期表示は非表示にする
	$('#snavi').toggle();

	$("#btn01").click(function() {
		$("#snavi").toggle();
	});
});