
$(function(){
	
	$('.rules_nav .rules_nav_t').on('click',function(){
		var cdr = $(this).parent().index();
		$('.rules_nav').eq(cdr).addClass('on').siblings().removeClass('on');
		$(this).parent().find('ul').slideToggle(300);
	})
	$('.rules_nav ul li').on('click',function(){
		var cdr = $(this).parent().parent().index();
		$('.rules_nav').eq(cdr).addClass('on').siblings().removeClass('on');
		$('.rules_nav ul li').removeClass('on');
		$(this).addClass('on');
	})
	if($(window).width()>1024){
		try{
			
		
		var ft = $('.footer').offset().top-$(window).height()-70;
		$('.rules_l').height($(window).height()-$('.rules_l').offset().top-30);
		$(window).scroll(function(){
			if($(window).scrollTop()>=160){
				$('.rules_l').addClass('on');
			}else{
				$('.rules_l').removeClass('on');
			}
			if($(window).scrollTop()<ft){
				$('.rules_l').height($(window).height()-$('.rules_l').offset().top-30+$(window).scrollTop());
			}else{
				$('.rules_l').height($('.footer').offset().top-$(window).scrollTop()-85-180);
			}
			
			
		})
	}catch(e){
			//TODO handle the exception
		}
	}
	
	$(window).resize(function(){
		$('.ruhui_tlt h2').outerHeight($('.ruhui_tltr').outerHeight(true));
		$('.ruhui_tr h2').outerHeight($('.ruhui_tltr').outerHeight(true));
		$('.ruhui_tlb h2').outerHeight($('.ruhui_tlbr').outerHeight(true));
		$('.ruhui_trt').outerHeight($('.ruhui_tlbr').outerHeight(true));
	})
	$(window).resize();
	$('.sq_b table tr em').on('click', function () {
		$(this).siblings().last().val($(this).text());
		//console.log($(this).siblings().last().attr("name"));
		//$("#text").val($(this).text());
		$(this).addClass('on').siblings().removeClass('on');
	})
	$('.shenqing h2').on('click',function(){
		console.log($(window).width())
		var width = $(window).width()
		if(width <= 768){
			$('.sq_a').addClass('active');
		}else{
			$('.sq_b').addClass('active');
		}
		// $('.sq_b').slideToggle(300);
	})

})
