;

// scroll
$(function(){
	$('a[href^="#"]').click(function(){
		var speed = 500;
		var href= $(this).attr("href");
		var target = $(href == "#" || href == "" ? 'html' : href);
		var position = target.offset().top;
		$("html, body").animate({scrollTop:position}, speed, "swing");
		return false;
	});
});

//loader
window.onload = function() {
  var loader = document.getElementById('loading');
  loader.classList.add('loaded');
}

// inview
$(function() {
	$(".inviewfadeIn").on("inview", function(event, isInView, visiblePartX, visiblePartY) {
		if(isInView){
			$(this).stop().addClass("fadeIn");
        }else{

		}
    });
});

// pagetop
$(window).scroll(function(){
	var h = $(window).innerHeight();
	
	if ($(window).scrollTop() > 300) {
		$('#topcontrol').fadeIn();
	} else {
		$('#topcontrol').fadeOut();
	}
	
	if($("body").hasClass("indx")){
		if ($(window).scrollTop() > h) {
			$('#sp_menu').addClass("active");
		} else {
			$('#sp_menu').removeClass("active");
		}
		
		/*
		if ($(window).scrollTop() > 300) {
			$('#header_second').addClass("active");
		} else {
			$('#header_second').removeClass("active");
		}
		*/
	}
	else
	{
		if ($(window).scrollTop() > 480) {
			$('#sp_menu').addClass("active");
		} else {
			$('#sp_menu').removeClass("active");
		}
	}
		
});

// width height
$(document).ready(function(){
	var h = $(window).innerHeight();
	/*
	var slide_h = h-10;
	$("#main_slide01").height(slide_h);
	$("#second_slide01").height(slide_h);
	*/
	$(".inst_prof").height(h);
});

$(window).on('resize', function(){
	var h = $(window).innerHeight();
	/*
	var slide_h = h-10;
	$("#main_slide01").height(slide_h);
	$("#second_slide01").height(slide_h);
	*/
	$(".inst_prof").height(h);
});



/* swiper */
$(document).ready(function(){
	var main_swiper;
	var second_swiper;
	var slideLength = document.querySelectorAll('.swiper-container .swiper-slide').length;
	
	if (slideLength > 1) {
		main_swiper = new Swiper('#main_slide01.swiper-container', {
			loop: true,
			speed: 600,
			autoplay: {
				delay: 5000,
				stopOnLastSlide: false,
				disableOnInteraction: false,
				reverseDirection: false
			},
			navigation: {
				nextEl: '.swiper-button-next',
				prevEl: '.swiper-button-prev'
			},
			pagination: {
				el: '.swiper-pagination',
				type: 'bullets',
				clickable: true
			}
		});


		second_swiper = new Swiper('#second_slide01.swiper-container', {
			loop: true,
			speed: 600,
			autoplay: {
				delay: 5000,
				stopOnLastSlide: false,
				disableOnInteraction: false,
				reverseDirection: false
			},
			navigation: {
				nextEl: '.swiper-button-next',
				prevEl: '.swiper-button-prev'
			},
			pagination: {
				el: '.swiper-pagination',
				type: 'bullets',
				clickable: true
			}
		});
	}
	
 });

$(document).ready(function(){
	
	var swiper1;
	var swiper2;
	
	function my_swipe() {
		// スライド表示数
		var w = $(window).innerWidth();

		var slidesPerView = 8; 
		if(w<=1200){
			slidesPerView = 7; 
		}
		if(w<=1024){
			slidesPerView = 6; 
		}
		if(w<=900){
			slidesPerView = 4; 
		}
		if(w<=640){
			slidesPerView = 3; 
		}
		if(w<=380){
			slidesPerView = 2; 
		}
	
		var sliderSelector = '#insta_slide01'; // スライダーのコンテナーとなる要素のセレクタ
		var $slide = $(sliderSelector + ' .swiper-slide');
		var slidable = $slide.length >= slidesPerView;
		var containerModifierClass =  slidable ? 'is-active swiper-container-' : 'swiper-container-'; // スライドがアクティブな場合は、コンテナー要素にクラス名「is-active」を設定	

		if($('#insta_slide01').length) {
			swiper1 = new Swiper('#insta_slide01.swiper-container', {
				containerModifierClass: containerModifierClass,
				slidesPerView: slidesPerView,
				loop: slidable,
				loopAdditionalSlides:3,
				observer:true,
				observeParents:true,
				/*centeredSlides: true,*/
				spaceBetween:20,
				autoplay: {
					delay: 3000,
					stopOnLastSlide: false,
					disableOnInteraction: false,
					reverseDirection: false
				},
				navigation: {
					nextEl: '.swiper-button-next',
					prevEl: '.swiper-button-prev'
				},
				watchOverflow: true,
			});
		}
		
		$('.slider1 .swiper-slide').on('mouseover', function() {
			swiper1.autoplay.stop();
		});

		$('.slider1 .swiper-slide').on('mouseout', function() {
			swiper1.autoplay.start();
		});
		
		$('.slider1 .swiper-slide').on('touchstart', function() {
			swiper1.autoplay.stop();
		});

		$('.slider1 .swiper-slide').on('touchend', function() {
			swiper1.autoplay.start();
		});
		
		
		var sliderSelector02 = '#insta_slide02'; // スライダーのコンテナーとなる要素のセレクタ
		var $slide02 = $(sliderSelector02 + ' .swiper-slide');
		var slidable02 = $slide02.length >= slidesPerView;
		var containerModifierClass02 =  slidable02 ? 'is-active swiper-container-' : 'swiper-container-'; // スライドがアクティブな場合は、コンテナー要素にクラス名「is-active」を設定	

		if($('#insta_slide02').length) {
			swiper2 = new Swiper('#insta_slide02.swiper-container', {
				containerModifierClass: containerModifierClass02,
				slidesPerView: slidesPerView,
				loop: slidable02,
				loopAdditionalSlides:3,
				observer:true,
				observeParents:true,
				/*centeredSlides: true,*/
				spaceBetween:20,
				autoplay: {
					delay: 3000,
					stopOnLastSlide: false,
					disableOnInteraction: false,
					reverseDirection: false
				},
				navigation: {
					nextEl: '.swiper-button-next',
					prevEl: '.swiper-button-prev'
				},
				watchOverflow: true,
			});
		}
		
		$('.slider2 .swiper-slide').on('mouseover', function() {
			swiper2.autoplay.stop();
		});

		$('.slider2 .swiper-slide').on('mouseout', function() {
			swiper2.autoplay.start();
		});
		
		$('.slider2 .swiper-slide').on('touchstart', function() {
			swiper2.autoplay.stop();
		});

		$('.slider2 .swiper-slide').on('touchend', function() {
			swiper2.autoplay.start();
		});
		
		
	}
	my_swipe();
	
	$(window).on('resize', function(){
		if(swiper1){swiper1.destroy(true,true);}
		if(swiper2){swiper2.destroy(true,true);}
		my_swipe();
	});
	
 });


/* slick */
$(document).ready(function(){
	/* var w = $(window).innerWidth(); */
	
	$('.trial_slide').slick({
		autoplay:true,
		autoplaySpeed:3000,
		dots:false,
		centerMode:true,
		variableWidth:true,
		arrows:true,
		responsive:[{
			breakpoint:900,
			settings: {
				variableWidth:true,
			},
			breakpoint:480,
			settings: {
				arrows:false,
			},
		}]	
	});
	
	$('.personal_slide').slick({
		autoplay:true,
		autoplaySpeed:3000,
		dots:false,
		centerMode:false,
		variableWidth:true,
		arrows:true,
		responsive:[{
			breakpoint:900,
			settings: {
				variableWidth:true,
			},
			breakpoint:480,
			settings: {
				arrows:false,
			},
		}]	
	});
 });




/* スマホメニュー */
$(document).ready(function(){
	if((navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') == -1) || navigator.userAgent.indexOf('A1_07') > 0 || navigator.userAgent.indexOf('SC-01C') > 0 || navigator.userAgent.indexOf('iPad') > 0){
		$("#sp_menu").bind("touchend",function(){
			
			if($(".menu-trigger").hasClass("active")){
				$(".menu-trigger").removeClass("active");
				$("#gnavi_sp").removeClass("active");
			}
			else
			{
				$(".menu-trigger").addClass("active");
				$("#gnavi_sp").addClass("active");
			}
		});
		
		$("#gnavi_sp a").bind("click",function(){
			
			if($(".menu-trigger").hasClass("active")){
				$(".menu-trigger").removeClass("active");
				$("#gnavi_sp").removeClass("active");
			}
			else
			{
				$(".menu-trigger").addClass("active");
				$("#gnavi_sp").addClass("active");
			}
		});
	}
	else if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0)){
		$("#sp_menu").bind("touchend",function(){
			
			if($(".menu-trigger").hasClass("active")){
				$(".menu-trigger").removeClass("active");
				$("#gnavi_sp").removeClass("active");
			}
			else
			{
				$(".menu-trigger").addClass("active");
				$("#gnavi_sp").addClass("active");
			}
		});
		
		$("#gnavi_sp a").bind("click",function(){
			
			if($(".menu-trigger").hasClass("active")){
				$(".menu-trigger").removeClass("active");
				$("#gnavi_sp").removeClass("active");
			}
			else
			{
				$(".menu-trigger").addClass("active");
				$("#gnavi_sp").addClass("active");
			}
		});
	}
	else{
		$("#sp_menu").bind("click",function(){
			
			if($(".menu-trigger").hasClass("active")){
				$(".menu-trigger").removeClass("active");
				$("#gnavi_sp").removeClass("active");
			}
			else
			{
				$(".menu-trigger").addClass("active");
				$("#gnavi_sp").addClass("active");
			}
		});
		
		$("#gnavi_sp a").bind("click",function(){
			
			if($(".menu-trigger").hasClass("active")){
				$(".menu-trigger").removeClass("active");
				$("#gnavi_sp").removeClass("active");
			}
			else
			{
				$(".menu-trigger").addClass("active");
				$("#gnavi_sp").addClass("active");
			}
		});
	}
});


/* インストPROF */
$(document).ready(function(){
	if((navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') == -1) || navigator.userAgent.indexOf('A1_07') > 0 || navigator.userAgent.indexOf('SC-01C') > 0 || navigator.userAgent.indexOf('iPad') > 0){
		$(".prof_lnk").bind("touchend",function(){
			var prof_class=$(this).attr("prof_id");
			$(".inst_prof").each(function() {
				if($(this).hasClass(prof_class)){
					$(this).addClass("active");	
				}
				else{
					$(this).removeClass("active");	
				}
			});
		});
		
		$(".prof_close").bind("touchend",function(){
			$(this).closest(".inst_prof").removeClass("active");
		});
		
		$(".prof_bg").bind("touchend",function(){
			$(this).closest(".inst_prof").removeClass("active");
		});
	}
	else if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0)){
		$(".prof_lnk").bind("touchend",function(){
			var prof_class=$(this).attr("prof_id");
			$(".inst_prof").each(function() {
				if($(this).hasClass(prof_class)){
					$(this).addClass("active");	
				}
				else{
					$(this).removeClass("active");	
				}
			});
		});
		
		$(".prof_close").bind("touchend",function(){
			$(this).closest(".inst_prof").removeClass("active");
		});
		
		$(".prof_bg").bind("touchend",function(){
			$(this).closest(".inst_prof").removeClass("active");
		});
	}
	else{
		$(".prof_lnk").bind("click",function(){
			var prof_class=$(this).attr("prof_id");
			$(".inst_prof").each(function() {
				if($(this).hasClass(prof_class)){
					$(this).addClass("active");	
				}
				else{
					$(this).removeClass("active");	
				}
			});
		});
		
		$(".prof_close").bind("click",function(){
			$(this).closest(".inst_prof").removeClass("active");
		});
		
		$(".prof_bg").bind("click",function(){
			$(this).closest(".inst_prof").removeClass("active");
		});
	}
});

$(function () {
	$(".prof_thumb_img img").on("click", function () {
		var prof_img = $(this).attr("src");
		var prof_main_img = $(this).closest("ul").siblings(".prof_main_pic").children("img");
		prof_main_img.fadeOut(500, function () {
			prof_main_img
				.attr("src", prof_img)
				.on("load", function () {
				$(this).fadeIn(500);
			});
		});
	});
});



/* インストタブ */
$(document).ready(function(){
	if((navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') == -1) || navigator.userAgent.indexOf('A1_07') > 0 || navigator.userAgent.indexOf('SC-01C') > 0 || navigator.userAgent.indexOf('iPad') > 0){
		$(".inst_cate_btn").bind("touchend",function(){
			var inst_cate=$(this).attr("inst_cate");
			if(inst_cate=="all"){
				$(".inst_item").each(function() {
					$(this).show();
					$(this).addClass("visi_inst");
				});
			}else{
				$(".inst_item").each(function() {
					if($(this).hasClass(inst_cate)){
						$(this).show();
						$(this).addClass("visi_inst");
					}
					else{
						$(this).hide();
						$(this).removeClass("visi_inst");
					}
				});
			}
			
			$(".inst_cate_btn").each(function() {
				$(this).removeClass("cur");
			});
			
			$(this).addClass("cur");
		});
	}
	else if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0)){
		$(".inst_cate_btn").bind("touchend",function(){
			var inst_cate=$(this).attr("inst_cate");
			if(inst_cate=="all"){
				$(".inst_item").each(function() {
					$(this).show();
					$(this).addClass("visi_inst");
				});
			}else{
				$(".inst_item").each(function() {
					if($(this).hasClass(inst_cate)){
						$(this).show();
						$(this).addClass("visi_inst");
					}
					else{
						$(this).hide();
						$(this).removeClass("visi_inst");
					}
				});
			}
			
			$(".inst_cate_btn").each(function() {
				$(this).removeClass("cur");
			});
			
			$(this).addClass("cur");
		});
	}
	else{
		$(".inst_cate_btn").bind("click",function(){
			var inst_cate=$(this).attr("inst_cate");
			if(inst_cate=="all"){
				$(".inst_item").each(function() {
					$(this).show();
					$(this).addClass("visi_inst");
				});
			}else{
				$(".inst_item").each(function() {
					if($(this).hasClass(inst_cate)){
						$(this).show();
						$(this).addClass("visi_inst");
					}
					else{
						$(this).hide();
						$(this).removeClass("visi_inst");
					}
				});
			}
			
			$(".inst_cate_btn").each(function() {
				$(this).removeClass("cur");
			});
			
			$(this).addClass("cur");
		});
	}
});


$(function(){
	var cate_type = getParam('cate');	
	$(".inst_item").each(function() {
		$(this).show();
		$(this).addClass("visi_inst");
	});
	
	if(cate_type){
		$("body").addClass(cate_type);	

		$(".inst_item").each(function() {
			if($(this).hasClass(cate_type)){
				$(this).show();
				$(this).addClass("visi_inst");
			}
			else{
				$(this).hide();
				$(this).removeClass("visi_inst");
			}
		});

		$(".inst_tab").children("li").each(function() {
			if($(this).hasClass(cate_type)){
				$(this).children("a").addClass("cur");
			}
			else{
				$(this).children("a").removeClass("cur");
			}
		});
	}
});




/* FAQ */
$(document).ready(function(){
	if((navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') == -1) || navigator.userAgent.indexOf('A1_07') > 0 || navigator.userAgent.indexOf('SC-01C') > 0 || navigator.userAgent.indexOf('iPad') > 0){
		$(".que_btn").bind("touchend",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
			}
			else
			{
				$(this).addClass("active");
			}
			$(this).siblings(".ans").slideToggle();
		});
	}
	else if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0)){
		$(".que_btn").bind("touchend",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
			}
			else
			{
				$(this).addClass("active");
			}
			$(this).siblings(".ans").slideToggle();
		});
	}
	else{
		$(".que_btn").bind("click",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
			}
			else
			{
				$(this).addClass("active");
			}
			$(this).siblings(".ans").slideToggle();
		});
	}
});


/* course_btn */
$(document).ready(function(){
	if((navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') == -1) || navigator.userAgent.indexOf('A1_07') > 0 || navigator.userAgent.indexOf('SC-01C') > 0 || navigator.userAgent.indexOf('iPad') > 0){
		$(".course_btn").bind("touchend",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
			}
			else
			{
				$(this).addClass("active");
			}
			$(this).siblings("dd").slideToggle();
		});
	}
	else if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0)){
		$(".course_btn").bind("touchend",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
			}
			else
			{
				$(this).addClass("active");
			}
			$(this).siblings("dd").slideToggle();
		});
	}
	else{
		$(".course_btn").bind("click",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
			}
			else
			{
				$(this).addClass("active");
			}
			$(this).siblings("dd").slideToggle();
		});
	}
});


/* contact birthday */
$(document).ready(function(){
	var birthday;
	var telno;
	var notshow = "-";
	
	if(($(".member_check").prop('checked')==true)){
		$(".member_form_item").show();
		$("#telno").val(telno);
	}
	else
	{
		$(".member_form_item").hide();
		$("#telno").val(notshow);
	}
	
	/*
	$(".dateset").find("select").change(function(){
		var year = $(".birth_year").val();
		var month = $(".birth_month").val();
		var date = $(".birth_date").val();
		birthday = year + "年" + month + "月" + date + "日";
		$("#birthday").val(birthday);
	});
	*/
	$("#telno_input").change(function(){
		telno = $(this).val();
		$("#telno").val(telno);
	});
	
	$("input.radio_check").change( function() {  
		if(($(".member_check").prop('checked')==true)){
			$(".member_form_item").slideDown();
			
			/*$("#birthday").val(birthday);*/
			telno = $("#telno_input").val();
			$("#telno").val(telno);
		}
		else
		{
			$(".member_form_item").slideUp();
			
			/*$("#birthday").val(notshow);*/
			$("#telno").val(notshow);
		}
	});
	
});

/* contact validation */
$(function(){
	//<form>タグのidを指定
	$("#form01").validationEngine(
		'attach', {
			promptPosition: "topLeft", //エラーメッセージ位置の指定
			binded:false
		}
	);
});

/* フォーム用agree */
$(function(){
	if(($("#agree").prop('checked'))){
		$("#submit").removeAttr("disabled");
	}

	$("#agree").change( function() {  
		if(($("#agree").prop('checked'))){
			$("#submit").removeAttr("disabled");
		}
		else
		{
			$("#submit").attr("disabled","disabled");
		}
	});
});



/* パラメータ取得 */
$(function(){
	var class_type = getParam('cl_type');	
	$("body").addClass(class_type);	
});

/**
 * Get the URL parameter value
 *
 * @param  name {string} パラメータのキー文字列
 * @return  url {url} 対象のURL文字列（任意）
 */
function getParam(name, url) {
    if (!url) url = window.location.href;
    name = name.replace(/[\[\]]/g, "\\$&");
    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
        results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, " "));
}





/* price アコーディオン */
$(document).ready(function(){
	if((navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') == -1) || navigator.userAgent.indexOf('A1_07') > 0 || navigator.userAgent.indexOf('SC-01C') > 0 || navigator.userAgent.indexOf('iPad') > 0){
		$(".price_btn_area").bind("touchend",function(){
			if($(this).parent(".price_ttl_btn").hasClass("active")){
				$(this).parent(".price_ttl_btn").removeClass("active");
			}
			else
			{
				$(this).parent(".price_ttl_btn").addClass("active");
			}
			$(this).closest(".price_h2").siblings(".price_set_box").slideToggle();
		});
	}
	else if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0)){
		$(".price_btn_area").bind("touchend",function(){
			if($(this).parent(".price_ttl_btn").hasClass("active")){
				$(this).parent(".price_ttl_btn").removeClass("active");
			}
			else
			{
				$(this).parent(".price_ttl_btn").addClass("active");
			}
			$(this).closest(".price_h2").siblings(".price_set_box").slideToggle();
		});
	}
	else{
		$(".price_btn_area").bind("click",function(){
			if($(this).parent(".price_ttl_btn").hasClass("active")){
				$(this).parent(".price_ttl_btn").removeClass("active");
			}
			else
			{
				$(this).parent(".price_ttl_btn").addClass("active");
			}
			$(this).closest(".price_h2").siblings(".price_set_box").slideToggle();
		});
		/*
		$(".price_ttl_btn").bind("click",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
			}
			else
			{
				$(this).addClass("active");
			}
			$(this).parent(".price_h2").siblings(".price_set_box").slideToggle();
		});
		*/
	}
});



/* trial アコーディオン */
/*
window.setTimeout(function(){
	$(".step_ex").hide();
}, 500);
*/

$(document).ready(function(){
	
	if((navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') == -1) || navigator.userAgent.indexOf('A1_07') > 0 || navigator.userAgent.indexOf('SC-01C') > 0 || navigator.userAgent.indexOf('iPad') > 0){
		$(".trial_step_open").bind("touchend",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
				$(this).siblings(".step_ex").removeClass("active");
			}
			else
			{
				$(this).addClass("active");
				$(this).siblings(".step_ex").addClass("active");
			}
			/*$(this).siblings(".step_ex").slideToggle();*/
		});
	}
	else if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0)){
		$(".trial_step_open").bind("touchend",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
				$(this).siblings(".step_ex").removeClass("active");
			}
			else
			{
				$(this).addClass("active");
				$(this).siblings(".step_ex").addClass("active");
			}
			/*$(this).siblings(".step_ex").slideToggle();*/
		});
	}
	else{
		$(".trial_step_open").bind("click",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
				$(this).siblings(".step_ex").removeClass("active");
			}
			else
			{
				$(this).addClass("active");
				$(this).siblings(".step_ex").addClass("active");
			}
			/*$(this).siblings(".step_ex").slideToggle();*/
		});
	}
});



// faq sticky
$(window).scroll(function(){
	
	var view_wide = $(window).innerWidth();
	
	/*var h = $(window).innerHeight();
	var doch = $(document).innerHeight(); //ページ全体の高さ
	var bottom = doch - h; //ページ全体の高さ - ウィンドウの高さ = ページの最下部位置
	
	var access_h = $("#indx_access_sec").height(); //アクセスセクションの高さ
	var footer_h = $("#footer").height(); //フッタの高さ*/
	
	var main_h = $("#second_main").height() + 20; //メインビジュアルの高さ
	var header_h = main_h + 70; // コンテナまでの高さ
	
	var container_h = $(".faq_container").height(); //コンテナの高さ
	var sticky_h = $(".faq_sticky").height(); //メニューエリアの高さ
	var sticky_stop = container_h - sticky_h + header_h ;//スティッキーの止め位置
	var sticky_stop_sp = container_h + header_h ;//スティッキーの止め位置
	
	/*var btm_point = doch - access_h - footer_h;
	var btm_h = access_h + footer_h;*/
	
	
	if (navigator.userAgent.indexOf('iPhone') > 0 || navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0) {
		
		if (view_wide < 901) {
			$('.faq_cont').css('padding-top' , 40 + 'px');
			
		}
		
		if ($(window).scrollTop() > sticky_stop_sp) {
			$('.faq_sticky').css('top' , 'auto');
			/*$('.faq_sticky').css('bottom' , 0);*/
			$('.faq_sticky').css('position' , 'absolute');
		} else if ($(window).scrollTop() > header_h) {
			$('.faq_sticky').css('top' , 65 +'px');
			/*$('.faq_sticky').css('bottom' , 'auto');*/
			$('.faq_sticky').css('position' , 'fixed');
			
			$('.faq_cate_list').css('position' , 'absolute');
		} else {
			$('.faq_sticky').removeClass("sticky");
			$('.faq_sticky').css('top' , 0);
			$('.faq_sticky').css('position' , 'relative');
			
			$('.faq_cate_list').css('position' , 'relative');
		}
	} else if (navigator.userAgent.indexOf('iPad') > 0 || navigator.userAgent.indexOf('Android') > 0) {
		
		if (view_wide < 901) {
			$('.faq_cont').css('padding-top' , 40 + 'px');
			
		}
		
		if ($(window).scrollTop() > sticky_stop_sp) {
			$('.faq_sticky').css('top' , 'auto');
			/*$('.faq_sticky').css('bottom' , 0);*/
			$('.faq_sticky').css('position' , 'absolute');
		} else if ($(window).scrollTop() > header_h) {
			$('.faq_sticky').css('top' , 65 +'px');
			/*$('.faq_sticky').css('bottom' , 'auto');*/
			$('.faq_sticky').css('position' , 'fixed');
			
			$('.faq_cate_list').css('position' , 'absolute');
		} else {
			$('.faq_sticky').removeClass("sticky");
			$('.faq_sticky').css('top' , 0);
			$('.faq_sticky').css('position' , 'relative');
			
			$('.faq_cate_list').css('position' , 'relative');
		}
		
	} else {
		// PC向けの記述
		
		if ($(window).scrollTop() > sticky_stop) {
			$('.faq_sticky').addClass("sticky_btm");
			$('.faq_sticky').css('top' , sticky_stop + 'px');
		} else if ($(window).scrollTop() > header_h) {
			$('.faq_sticky').addClass("sticky");
			
			if (view_wide < 901) {
				$('.faq_sticky').css('top' , $(window).scrollTop()+65+'px');
			}
			else{
				$('.faq_sticky').css('top' , $(window).scrollTop()+70+'px');
			}
		} else {
			$('.faq_sticky').removeClass("sticky");
			$('.faq_sticky').css('top' , '');
		}
	}
	
});


/* faq カテゴリ SP */
$(document).ready(function(){
	var view_wide;
	
	if((navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') == -1) || navigator.userAgent.indexOf('A1_07') > 0 || navigator.userAgent.indexOf('SC-01C') > 0 || navigator.userAgent.indexOf('iPad') > 0){
		$("#faq_cate_open").bind("touchend",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
			}
			else
			{
				$(this).addClass("active");
			}
			$(this).parent(".sp_cate_btn").siblings(".faq_cate_list").slideToggle();
		});
		
		$(".faq_cate_list li a").bind("touchend",function(){
			view_wide = $(window).innerWidth();
			
			if (view_wide < 901) {
			
				$(this).closest(".faq_cate_list").slideToggle();

				if($("#faq_cate_open").hasClass("active")){
					$("#faq_cate_open").removeClass("active");
				}
				else
				{
					$("#faq_cate_open").addClass("active");
				}
			}
		});
	}
	else if ((navigator.userAgent.indexOf('iPhone') > 0 && navigator.userAgent.indexOf('iPad') == -1) || navigator.userAgent.indexOf('iPod') > 0 || (navigator.userAgent.indexOf('Android') > 0 && navigator.userAgent.indexOf('Mobile') > 0)){
		$("#faq_cate_open").bind("touchend",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
			}
			else
			{
				$(this).addClass("active");
			}
			$(this).parent(".sp_cate_btn").siblings(".faq_cate_list").slideToggle();
		});
		
		$(".faq_cate_list li a").bind("touchend",function(){
			view_wide = $(window).innerWidth();
			
			if (view_wide < 901) {
			
				$(this).closest(".faq_cate_list").slideToggle();

				if($("#faq_cate_open").hasClass("active")){
					$("#faq_cate_open").removeClass("active");
				}
				else
				{
					$("#faq_cate_open").addClass("active");
				}
			}
		});
	}
	else{
		$("#faq_cate_open").bind("click",function(){
			if($(this).hasClass("active")){
				$(this).removeClass("active");
			}
			else
			{
				$(this).addClass("active");
			}
			$(this).parent(".sp_cate_btn").siblings(".faq_cate_list").slideToggle();
		});
		
		$(".faq_cate_list li a").bind("click",function(){
			view_wide = $(window).innerWidth();
			
			if (view_wide < 901) {
			
				$(this).closest(".faq_cate_list").slideToggle();

				if($("#faq_cate_open").hasClass("active")){
					$("#faq_cate_open").removeClass("active");
				}
				else
				{
					$("#faq_cate_open").addClass("active");
				}
			}
		});
	}
});

