	// JavaScript Document

//一级切换
function show_a(){ 
	$('#lottery1').addClass("hover_a");
	$('#lottery2').removeClass("hover_a");
	$('#lottery3').removeClass("hover_a");
	$('#lottery4').removeClass("hover_a");
	$('#con_lottery_1').show();
	$('#radio_cont2').hide();
	$('#con_lottery_3').hide();
	$('#con_lottery_4').hide();
	$("input[id='radio_hm_a']").attr("checked",true);
	}
function show_b(){
	$('#lottery1').removeClass("hover_a");
	$('#lottery2').addClass("hover_a");
	$('#lottery3').removeClass("hover_a");
	$('#lottery4').removeClass("hover_a");
	$('#con_lottery_1').show();
	$('#radio_cont2').show();
	$('#con_lottery_3').hide();
	$('#con_lottery_4').hide();
	$("input[id='radio_hm_b']").attr("checked",true);
	}
function show_c(){
	$('#lottery1').removeClass("hover_a");
	$('#lottery2').removeClass("hover_a");
	$('#lottery3').addClass("hover_a");
	$('#lottery4').removeClass("hover_a");
	$('#con_lottery_1').hide();
	$('#radio_cont2').hide();
	$('#con_lottery_3').show();
	$('#con_lottery_4').hide();
	}
function show_d(){
	$('#lottery1').removeClass("hover_a");
	$('#lottery2').removeClass("hover_a");
	$('#lottery3').removeClass("hover_a");
	$('#lottery4').addClass("hover_a");
	$('#con_lottery_1').hide();
	$('#radio_cont2').hide();
	$('#con_lottery_3').hide();
	$('#con_lottery_4').show();
	}
//侧边栏切换
function set_tab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
menu.className=(i==cursel?"hover":"");
con.style.display=((i==cursel)?"block":"none");
}
}
function set_sum(nameb,curselb,m){
	for(i=1;i<=m;i++){
	var menub=document.getElementById(nameb+i);
	var conb=document.getElementById("cont_"+nameb+"_"+i);
	menub.className=(i==curselb?"menu_on":"");
	conb.style.display=((i==curselb)?"block":"none");
}
}

//玩法切换
function set_input(namea,cursela,x){
	for(y=1;y<=x;y++){
	var menua=document.getElementById(namea+y);
	var cont=document.getElementById("cont_"+namea+"_"+y);
	//alert("cont_"+namea+"_"+y);
	//alert("cont="+cont);
	menua.className=y==cursela?"menu_on":"";
	cont.style.display=y==cursela?"block":"none";
	if(namea=="btn"){
			if(y==cursela){
				document.getElementById("t1"+"_mode"+y).checked = true;
			}else{
				//alert("t1"+"_mode"+y);
				document.getElementById("t1"+"_mode"+y).checked = false;
			}
	}else if(namea=="z3_btn"){
			if(y==cursela){
				document.getElementById("t2"+"_mode"+y).checked = true;
			}else{
				document.getElementById("t2"+"_mode"+y).checked = false;
			}
	}else if(namea=="z6_btn"){
			if(y==cursela){
				document.getElementById("t3"+"_mode"+y).checked = true;
			}else{
				document.getElementById("t3"+"_mode"+y).checked = false;
			}
	}
}
}
//投注方式切换
/*function radio_hemai(num){
	 $("input[name='radio_hm']").click(function(){
		$("#radio_cont > div").hide();

		$("#radio_cont"+$(this).val()).show();
    });
};*/

//投注方式切换
function radio_hemai(num){
	if(num==1){
		document.getElementById("radio_hm_a").checked = true;
		document.getElementById("radio_hm_b").checked = false;
		document.getElementById("radio_hm_c").checked = false;
		$("#radio_cont1").show();
		$("#radio_cont2").hide();
		$("#radio_cont3").hide();
	}else if(num==2){
		document.getElementById("radio_hm_a").checked = false;
		document.getElementById("radio_hm_b").checked = true;
		document.getElementById("radio_hm_c").checked = false;
		$("#radio_cont1").hide();
		$("#radio_cont2").show();
		$("#radio_cont3").hide();
	}else{
		document.getElementById("radio_hm_a").checked = false;
		document.getElementById("radio_hm_b").checked = false;
		document.getElementById("radio_hm_c").checked = true;
		$("#radio_cont1").hide();
		$("#radio_cont2").hide();
		$("#radio_cont3").show();
	}




	/* $("input[name='radio_hm']").click(function(){
		$("#radio_cont > div").hide();

		$("#radio_cont"+$(this).val()).show();
    });*/
};

/*function radio_lottery(){
	 $("input[name='radio_lottery']").click(function(){
		$("#radio_con > div").hide();
		$("#radio_con"+$(this).val()).show();
		alert($(this).val());
		/*for(int i=1;i<4;i++){
			if(i==$(this).val()){
				//alert("t"+$(this).val());
				//document.getElementById("t" +$(this).val()).checked = true;
			}else{
				//document.getElementById("t" + i).checked = false;
			}
		}	
    });
};
*/

//玩法选择
function radio_lottery(num){
		for(var i=1;i<4;i++)
		{
			if(i==num){
				$("#radio_con"+i).show();
				document.getElementById("radio_lottery" +i).checked = true;
				document.getElementById("t" +i).checked = true;
				document.getElementById("t" +i+"_mode1").checked = true;
				if(num==1){
					set_input('btn',1,5);
				}else if(num==2){
					set_input('z3_btn',1,4);
				}else if(num==3){
					set_input('z6_btn',1,4);
				}
				//alert(document.getElementById("t" +i).checked ==true);
			}else{
				document.getElementById("radio_lottery" +i).checked = false;
				$("#radio_con"+i).hide();
				document.getElementById("t" +i).checked = false;
				document.getElementById("t" +i+"_mode1").checked = false;
				document.getElementById("t" +i+"_mode2").checked = false;
				document.getElementById("t" +i+"_mode3").checked = false;
				document.getElementById("t" +i+"_mode4").checked = false;
			}
		}
}


//购买彩票
function open_ck(){
	$("#hidden_a").toggle();
}
function my_cai(){
	$(".cai_hidden").toggle();
}
function cacle_on(){
	$(".prompt").toggle();
}
function date_click(){
	$("#date_con").toggle();
	if(document.getElementById("date_con").style.display=="none"){
		checkRegMore(false);
	}else{
		checkRegMore(true);
	}
	
}


function news_loading_ajax(url,loading_id)
{
	
	
	$("#" + loading_id).html("<div class=\"news_loading\">正在加载中...</div>");
	var html = $.ajax({
	url: url,
	async: false
	}).responseText; 

	$("#" + loading_id).html(html);

}

function loading_ajax(url,loading_id)
{
	
	
	$("#" + loading_id).html("<span class=\"ajax_loading\">正在发信中...</span>");
	var html = $.ajax({
	url: url,
	async: false
	}).responseText; 

	$("#" + loading_id).html(html);

}


function loading_ajax2(url,loading_id,s)
{
	
	$("#" + loading_id).html("<div class=\"news_loading\">" + s + "...</div>");
	var html = $.ajax({
	url: url,
	async: false
	}).responseText; 

	$("#" + loading_id).html(html);

}

//含中文的字符串长度
function getStrLen(str){
	var len = 0;
	var cnstrCount = 0;
	for(var i = 0 ; i < str.length ; i++){
		if(str.charCodeAt(i)>255)
		cnstrCount = cnstrCount + 1 ;
	}
	len = str.length + cnstrCount;
	return len;
}


function isConfirm(str)
{
	var box=window.confirm("提示：\n\n"+str);
	if(box){
		return true;}
	else{
		return false;
	}
}


//整数验证
function isInt(s)
{
	if(s.search(/^[0-9]+$/)!=-1)
		return true;
	else
		return false;
}

//日期验证
function isDate(sDate) {
	var iYear, iMonth, iDay, iIndex

	var	reg
	reg = new RegExp('[^0-9-]','')
	if (sDate.search(reg) >= 0)
		return false;
	
	iIndex = sDate.indexOf('-');
	if ( iIndex == -1 )
		return false;
	else {
		iYear = parseFloat(sDate.substr(0, iIndex));
		if ( isNaN(iYear) || iYear < 1900 || iYear > 2099 )
			return false;
		else
			sDate = sDate.substring(iIndex + 1, sDate.length);
	}
	
	iIndex = sDate.indexOf('-');
	if ( iIndex == -1 )
		return false;
	else {
		iMonth = parseFloat(sDate.substr(0, iIndex));
		if ( isNaN(iMonth) || iMonth < 1 || iMonth > 12 )
			return false;
		else
			sDate = sDate.substring(iIndex + 1, sDate.length);
	}
	
	iIndex = sDate.indexOf('-');
	if ( iIndex >= 0 )
		return false;
	else {
		iDay = parseFloat(sDate);
		if ( isNaN(iDay) || iDay < 1 || iDay > 31 )
			return false;
	}
	
	
	switch(iMonth) {
		case 4:
		case 6:
		case 9:
		case 11:
			if ( iDay > 30 )
				return false;
			else
				break;
		case 2:
			if ( ( ( iYear % 4 == 0 && iYear % 100 != 0 ) || iYear % 400 == 0 ) && iDay > 29 )
				return false;
			else if ( (iYear % 4 != 0 || (iYear % 100 == 0 && iYear % 400 != 0)) && iDay > 28 )
				return false;
			else
				break;
		default:
	}
	return true;
}

//验证合法邮箱
function isEmail(s)
{
	if (s.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}
function isMobile(s)
{
	if (s.search(/^(13|15|18)[0-9]{9}$/) != -1)
		return true;
	else
		return false;
}

//登录框
function login_pop(){
var e = new Pop({ oPop: "login_pop", zIndex: 1001, mode: ["center", "center"], idOpen: "open_e", idClose: ["close_e", "close_e_1"], cover: true, beCover: false, zIndexCover: 1000, colorCover: "#ccc", opactiyCover: 0.5 });
};

// 汉字长度
function JsHshStrLen(sString){
	var sStr,iCount,i,strTemp ;
	iCount = 0 ;
	sStr = sString.split("");
	for (i = 0 ; i < sStr.length ; i ++){
		strTemp = escape(sStr[i]);
		if (strTemp.indexOf("%u",0) == -1){ 	 // 表示是汉字
			iCount = iCount + 1 ;
		}else{
			iCount = iCount + 2 ;
		}
	}
	return iCount ;
}

function copyUrl(values)
{
var clipBoardContent=values;
window.clipboardData.setData("Text",clipBoardContent);
alert("复制成功!");
}

// 战绩图形显示
function len(s) { 
	var l = 0; 
	var a = s.split(""); 
	for (var i=0;i<a.length;i++) { 
	if (a[i].charCodeAt(0)<299) { 
	l++; 
	} else { 
	l+=2; 
	} 
	} 
	return l; 
} 
function getScorePic(x,y){
	
	
	var i = x.toString(5);


	var a = i.split(""); 
	var k=1;
	var level_1_pic = "";
	var level_2_pic = "";
	var level_3_pic = "";
	var level_4_pic = "";
	var level_5_pic = "";

	for (i=a.length-1;i>=0;i--) { 

		for(var j=0;j<a[i];j++){
			
			if(k==1)
				level_1_pic = level_1_pic + "<img src='../images/user/05star_"+y+"in.png' width=16 height=16 />";
			else if(k==2)
				level_2_pic = level_2_pic + "<img src='../images/user/04moon_"+y+"in.png' width=16 height=16 />";
			else if(k==3)
				level_3_pic = level_3_pic + "<img src='../images/user/03sun_"+y+"in.png' width=16 height=16 />";
			else if(k==4)
				level_4_pic = level_4_pic + "<img src='../images/user/02diamond_"+y+"in.png' width=16 height=16 />";
			else if(k==5)
				level_5_pic = level_5_pic + "<img src='../images/user/01crown_"+y+"in.png' width=16 height=16 />";
			
		}
		k++;
	}

	return level_5_pic+level_4_pic+level_3_pic+level_2_pic+level_1_pic;



}

//我要保底
function check_end(){
	if($("#check_end").attr("checked")==true){
		$("#check_none").show();
		}else{
		$("#check_none").hide();
		}
	}

function fen2yuan(num){

	var result="";
	var len=(num+"").length;
	
	if(len==2){
		result="0."+num;
	}else if(len>2){

		var before=(num+"").substring(0,len-2);
		var after=(num+"").substring(len-2,len);

		if(after=="00"){
			result=before;
		}else{
			result=before+"."+after;
		}
	}

	if(result.substring(len,len+1)=="0"){

		result=result.substring(0,len);
	}
	return result;
}
//iframe 自适应高度
function adjustFrameSize(iframe_id)
  {
            var frm = document.getElementById(iframe_id); //将iframe1替换为你的ID名
            var subWeb = document.frames ? document.frames[iframe_id].document : frm.contentDocument;
           if(frm != null && subWeb != null)
          {
                   frm.style.height="0px";//初始化一下,否则会保留大页面高度
                   frm.style.height = subWeb.documentElement.scrollHeight+"px";
                   frm.style.width = subWeb.documentElement.scrollWidth+"px";
                   subWeb.body.style.overflowX="auto";
                   subWeb.body.style.overflowY="auto";

} }
//我的个人主页 标签切换
function cng_tab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
//var con=document.getElementById("con_"+name+"_"+i);
menu.className=(i==cursel?"hover":"");
//con.style.display=((i==cursel)?"block":"none");
}
}