

// FAQ
// ----------------------------------------------------------------------- //

$(function(){
	$("div.answer").hide();
	$(".faqBox h2").each(function(i) {
		target = $(this).siblings(".body");
		$(this).attr("class", "close");
		$(this).hover(function(){ $(this).css("cursor", "pointer") }, function(){ $(this).css("cursor", "pointer") });
	});

	function scroll(target){
		var targetOffset = $(target).parent().prev().offset().top;
		$('html,body').animate({scrollTop: targetOffset}, 500);
	}

	$(".faqBox h2").click(function(){
//		$(this).attr("class", "open");
	});

	$(".faqBox h2").click(function(){
		target = $(this).siblings(".answer");
//		$(target).slideToggle(200, scroll(this));
		$(target).slideToggle(200);

		now_status = $(this).attr("class");
//		console.log(now_status);

		if (now_status == "close") {
			$(".faqBox h2.open").each(function(i) {
				target = $(this).siblings(".answer");
				$(target).slideUp(300);
				$(this).attr("class", "close");
			});
			$(this).attr("class", "open");

		}
		else {
			$(this).attr("class", "close");
		}
	});

});

