$(function (){
    $(".hs_menu").click(function (){
      $zi=$("#h_menu");
   if($zi.is(":hidden")){
      $(".hs_menu span").text("收起");
	  $(".hs_menu b").removeClass("b_show");
   	  $zi.show(500);
   }else{
      $(".hs_menu span").text("更多");
	  $(".hs_menu b").addClass("b_show");
      $zi.hide(500);
   }
 })
})

$(function (){
    $(".menu_w h3").click(function (){
    	var h_arr = $(".menu_w h3 a");
    	var cur_text = $(this).text();
    	for(var i=0;i<h_arr.length;i++){
    		var text = $(h_arr[i]).html();
    		if(cur_text == text){
	        	$zi=$(h_arr[i]).parent().parent().find(".hsul");
	        	var z_child = $(h_arr[i]).parent();
	        	if($zi.is(":hidden")){
		   	         $(this).addClass("open");
		   	         $(h_arr[i]).css("background-position","-156px -82px");
		   	      	 $zi.show(500);
		   	    }else{
			    	 $(this).removeClass("open");
			    	 $(h_arr[i]).css("background-position","-156px -67px");
			    	 $zi.hide(500);
		   	    }
	        	break;
    		}else{
    			continue;
    		}
    	}
 });
});

/*左边菜单链接文字切换颜色*/
$(document).ready(function(){//  addClass("cur"); 
	var url = window.location.href;
	var urlarr = url.split("");
	
	if((urlarr[1].length>0)&&(urlarr[1]!="index.html")){
		if(url.indexOf("/Lottery.html")!=-1){
			$('#Lottery').addClass("cur");
		}else if(url.indexOf("/Lottery_ZhuiHao.html")!=-1){
			$('#Lottery-ZhuiHao').addClass("cur");
		}else if(url.indexOf("/Lottery-ZhongJiang.html")!=-1){
			$('#Lottery-ZhongJiang').addClass("cur");
		}else if(url.indexOf("/Lottery-Fd.html")!=-1){
			$('#Lottery-Fd').addClass("cur");
		}else if(url.indexOf("/User.html")!=-1){
			$('#User').addClass("cur");
		}else if(url.indexOf("/User-Password.html")!=-1){
			$('#User-Password').addClass("cur");
		}else if(url.indexOf("/User-QKPassword.html")!=-1){
			$('#User-QKPassword').addClass("cur");
		}else if(url.indexOf("/User-Bank.html")!=-1){
			$('#User-Bank').addClass("cur");
		}else if(url.indexOf("/index.html")!=-1){
			$('#index').addClass("cur");
		}else if(url.indexOf("/index-Statements.html")!=-1){
			$('#index-Statements').addClass("cur");
		}else if(url.indexOf("/index-Funds.html")!=-1){
			$('#index-Funds').addClass("cur");
		}else if(url.indexOf("/index-Pay.html")!=-1){
			$('#index-Pay').addClass("cur");
		}else if(url.indexOf("/index-Drawal.html")!=-1){
			$('#index-Drawal').addClass("cur");
		}else if(url.indexOf("/Question.html")!=-1){
			$('#Question').addClass("cur");
		}else if(url.indexOf("/Agent.html")!=-1){
			$('#Agent').addClass("cur");
			show_more(1);
		}else if(url.indexOf("/Agent_Add.html")!=-1){
			$('#Agent_Add').addClass("cur");
			show_more(1);
		}else if(url.indexOf("/Agent-Money.html")!=-1){
			$('#Agent-Money').addClass("cur");
			show_more(1);
		}else if(url.indexOf("/Agent-NoMoney.html")!=-1){
			$('#Agent-NoMoney').addClass("cur");
			show_more(1);
		}else if(url.indexOf("/Agent-BaoBiao.html")!=-1){
			$('#Agent-BaoBiao').addClass("cur");
			show_more(1);
		}else if(url.indexOf("/Agent-MyTeam.html")!=-1){
			$('#Agent-MyTeam').addClass("cur");
			show_more(1);
		}else if(url.indexOf("/Agent_Buy.html")!=-1){
			$('#Agent_Buy').addClass("cur");	
			show_more(1);
		}else if(url.indexOf("/Agent-Drawal.html")!=-1){
			$('#Agent-Drawal').addClass("cur");	
			show_more(1);
		}
	}
}); 
/*公用*/
function show_more(show_one){
	if(show_one==1){
	    $zi=$("#h_menu");
	    if($zi.is(":hidden")){
		    $(".hs_menu span").text("收起");
			  $(".hs_menu b").removeClass("b_show");
		 	  $zi.show(500);
	    }
	}else{
	      $zi=$(".hsul");
	      if($zi.is(":hidden")){
		      $(this).addClass("open");
		   	  $zi.show(500);
	      }
	}
}