var SelRedball=0;
var SelBlueball=0;
var Selhzball=0;
var Selzxball=0;
var zxm=7;
var JCbwball=0;
var JCswball=0;
var JCgwball=0;

var $xuang=0;
var $xuang1=0;
var $xuang2=0;
var $xuang3=0;

var m3 = new Array();//创建一个新的数组
m3[0] = "奇奇奇";
m3[1] = "奇奇偶";
m3[2] = "奇偶奇";
m3[3] = "奇偶偶";
m3[4] = "偶奇奇";
m3[5] = "偶奇偶";
m3[6] = "偶偶奇";
m3[7] = "偶偶偶";
var m5 = new Array();//创建一个新的数组
m5[0] = "质质质";
m5[1] = "质质合";
m5[2] = "质合质";
m5[3] = "质合合";
m5[4] = "合质质";
m5[5] = "合质合";
m5[6] = "合合质";
m5[7] = "合合合";
var m6 = new Array();//创建一个新的数组
m6[0] = "大大大";
m6[1] = "大大小";
m6[2] = "大小大";
m6[3] = "大小小";
m6[4] = "小大大";
m6[5] = "小大小";
m6[6] = "小小大";
m6[7] = "小小小";

function clean(){
		for($i=0; $i<=9; $i++){
			document.all("JCbwb"+$i).checked=false;
			document.all("JCbb"+$i).checked=false;
			document.all("JCswb"+$i).checked=false;
			document.all("JCsb"+$i).checked=false;
			document.all("JCgwb"+$i).checked=false;
			document.all("JCgb"+$i).checked=false;
			document.all.bw.value="";
			document.all.sw.value="";
			document.all.gw.value="";
		}//循环

}

function Selhq(org){
	var obj=document.all("Selhq"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang1=1;
		SelRedball++;
		if(SelRedball>=3){
			alert("胆码最多只能选择2个！");
			SelRedball--;
			return;
		}
		document.all("Selhq"+org).style.backgroundColor="#f05000";
		document.all.hq.value=document.all.hq.value+" "+m;
	}else{
		$xuang1=0;
		document.all("Selhq"+org).style.backgroundColor="";
		document.all.hq.value=document.all.hq.value.replace(" "+m,""); 
		SelRedball--;
	}
}

function chk(Input,jczx1){	
	for(var i=0;i<document.form1.jczxlei.length;i++)
	{
	document.form1.jczxlei[i].checked = false;
	 }
	Input.checked = true;
	zxm=jczx1;
	document.all.jczx.value=""; 
	Selzxball=0;
	for($i=0; $i<=9; $i++){
		document.all("Selzx"+$i).style.backgroundColor="";
	}//循环
	return true;
	
}

function Selzx(org){
	var obj=document.all("Selzx"+org).style.backgroundColor;
	m=org;
	if(zxm==7){zxrt="组选六复式最多只能选6个";}else{zxrt="组选三复式和豹子最多只能选5个";}
	if(obj==""){
		$xuang1=1;
		Selzxball++;
		if(Selzxball>=zxm){
			alert(zxrt);
			Selzxball--;
			return;
		}
		document.all("Selzx"+org).style.backgroundColor="#f05000";
		document.all.jczx.value=document.all.jczx.value+" "+m;
	}else{
		$xuang1=0;
		document.all("Selzx"+org).style.backgroundColor="";
		document.all.jczx.value=document.all.jczx.value.replace(" "+m,""); 
		Selzxball--;
	}
}
//百位
function JCbw(org){
	var obj=document.all("JCbw"+org).style.backgroundColor;
	m=org;
	if(org=="110"){
		$xuang1=0;
		JCbwball=0;
		for($i=0; $i<=9; $i++){
			document.all("JCbw"+$i).style.backgroundColor="";
			document.all("JCb"+$i).style.backgroundColor="";
			document.all("JCbwb"+$i).checked=false;
			document.all("JCbb"+$i).checked=false;
		}//循环
		document.all.bw.value="";
	}else if(obj==""){
		$xuang1=1;
		JCbwball++;
		Heji(JCbwball,JCswball,JCgwball);
		if(Gs>64){
			alert("总注数不能超过64注！");
			JCbwball--;
			Heji(JCbwball,JCswball,JCgwball);
			return;
		}
		document.all("JCbwb"+org).checked=document.all("JCbwb"+org).checked==true?false:true;
		document.all("JCbb"+org).checked=document.all("JCbb"+org).checked==true?false:true;
		document.all("JCbw"+org).style.backgroundColor="#f05000";
		document.all("JCb"+org).style.backgroundColor="#f05000";
		document.all.bw.value=document.all.bw.value+" "+m;
	}else{
		$xuang1=0;
		document.all("JCbwb"+org).checked=document.all("JCbwb"+org).checked==true?false:true;
		document.all("JCbb"+org).checked=document.all("JCbb"+org).checked==true?false:true;
		document.all("JCbw"+org).style.backgroundColor="";
		document.all("JCb"+org).style.backgroundColor="";
		document.all.bw.value=document.all.bw.value.replace(" "+m,""); 
		JCbwball--;
		Heji(JCbwball,JCswball,JCgwball);
	}
}
//十位
function JCsw(org){
	var obj=document.all("JCsw"+org).style.backgroundColor;
	m=org;
	if(org=="110"){
		$xuang1=0;
		JCswball=0;
		for($i=0; $i<=9; $i++){
			document.all("JCsw"+$i).style.backgroundColor="";
			document.all("JCs"+$i).style.backgroundColor="";
			document.all("JCswb"+$i).checked=false;
			document.all("JCsb"+$i).checked=false;
		}//循环
		document.all.sw.value="";
	}else if(obj==""){
		$xuang1=1;
		JCswball++;
		Heji(JCbwball,JCswball,JCgwball);
		if(Gs>64){
			alert("总注数不能超过64注！");
			JCswball--;
			Heji(JCbwball,JCswball,JCgwball);
			return;
		}
		document.all("JCswb"+org).checked=document.all("JCswb"+org).checked==true?false:true;
		document.all("JCsb"+org).checked=document.all("JCsb"+org).checked==true?false:true;
		document.all("JCsw"+org).style.backgroundColor="#f05000";
		document.all("JCs"+org).style.backgroundColor="#f05000";
		document.all.sw.value=document.all.sw.value+" "+m;
	}else{
		$xuang1=0;
		document.all("JCswb"+org).checked=document.all("JCswb"+org).checked==true?false:true;
		document.all("JCsb"+org).checked=document.all("JCsb"+org).checked==true?false:true;
		document.all("JCsw"+org).style.backgroundColor="";
		document.all("JCs"+org).style.backgroundColor="";
		document.all.sw.value=document.all.sw.value.replace(" "+m,""); 
		JCswball--;
		Heji(JCbwball,JCswball,JCgwball);
	}
}
//个位
function JCgw(org){
	var obj=document.all("JCgw"+org).style.backgroundColor;
	m=org;
	if(org=="110"){
		$xuang1=0;
		JCgwball=0;
		for($i=0; $i<=9; $i++){
			document.all("JCgw"+$i).style.backgroundColor="";
			document.all("JCg"+$i).style.backgroundColor="";
			document.all("JCgwb"+$i).checked=false;
			document.all("JCgb"+$i).checked=false;
		}//循环
		document.all.gw.value="";
	}else if(obj==""){
		$xuang1=1;
		JCgwball++;
		Heji(JCbwball,JCswball,JCgwball);
		if(Gs>64){
			alert("总注数不能超过64注！");
			JCgwball--;
			Heji(JCbwball,JCswball,JCgwball);
			return;
		}
		document.all("JCgwb"+org).checked=document.all("JCgwb"+org).checked==true?false:true;
		document.all("JCgb"+org).checked=document.all("JCgb"+org).checked==true?false:true;
		document.all("JCgw"+org).style.backgroundColor="#f05000";
		document.all("JCg"+org).style.backgroundColor="#f05000";
		document.all.gw.value=document.all.gw.value+" "+m;
	}else{
		$xuang1=0;
		document.all("JCgwb"+org).checked=document.all("JCgwb"+org).checked==true?false:true;
		document.all("JCgb"+org).checked=document.all("JCgb"+org).checked==true?false:true;
		document.all("JCgw"+org).style.backgroundColor="";
		document.all("JCg"+org).style.backgroundColor="";
		document.all.gw.value=document.all.gw.value.replace(" "+m,""); 
		JCgwball--;
		Heji(JCbwball,JCswball,JCgwball);
	}
}
function Heji(bwgs,swgs,gwgs){
	Gs=bwgs*swgs*gwgs;
	document.all.gs.value=Gs; 
}

function Sellq(org){
	var obj=document.all("Sellq"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang2=1;
		SelBlueball++;
		if(SelBlueball>=4){
			alert("杀码最多只能选择3个！");
			SelBlueball--;
			return;
		}
		document.all("Sellq"+org).style.backgroundColor="#f05000";
		document.all.lq.value=document.all.lq.value+" "+m;
	}else{
		$xuang2=0;
		document.all("Sellq"+org).style.backgroundColor="";
		document.all.lq.value=document.all.lq.value.replace(" "+m,"");
		SelBlueball--;
	}
}

function Seljchz(org){
	var obj=document.all("Seljchz"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang1=1;
		Selhzball++;
		if(Selhzball>=3){
			alert("和值最多只能选择2个！");
			Selhzball--;
			return;
		}
		document.all("Seljchz"+org).style.backgroundColor="#f05000";
		document.all.jchz.value=document.all.jchz.value+" "+m;
	}else{
		$xuang1=0;
		document.all("Seljchz"+org).style.backgroundColor="";
		document.all.jchz.value=document.all.jchz.value.replace(" "+m,""); 
		Selhzball--;
	}
}

function Selqs(org){
	var obj=document.all("Selqs"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang++;
		document.all("Selqs0").style.backgroundColor="";
		document.all("Selqs1").style.backgroundColor="";
		document.all("Selqs2").style.backgroundColor="";
		document.all("Selqs3").style.backgroundColor="";
		document.all("Selqs4").style.backgroundColor="";
		document.all("Selqs5").style.backgroundColor="";
		document.all("Selqs6").style.backgroundColor="";
		document.all("Selqs7").style.backgroundColor="";
		document.all("Selqs"+org).style.backgroundColor="#f05000";
		m2=m3[m];
		document.all.qs.value=m2;
	}else{
		$xuang--;
		document.all("Selqs"+org).style.backgroundColor="";
		document.all.qs.value=document.all.qs.value.replace(m2,"");
	}
}

function Selzh(org){
	var obj=document.all("Selzh"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang++;
		document.all("Selzh0").style.backgroundColor="";
		document.all("Selzh1").style.backgroundColor="";
		document.all("Selzh2").style.backgroundColor="";
		document.all("Selzh3").style.backgroundColor="";
		document.all("Selzh4").style.backgroundColor="";
		document.all("Selzh5").style.backgroundColor="";
		document.all("Selzh6").style.backgroundColor="";
		document.all("Selzh7").style.backgroundColor="";
		document.all("Selzh"+org).style.backgroundColor="#f05000";
		m2=m5[m];
		document.all.zh.value=m2;
	}else{
		$xuang--;
		document.all("Selzh"+org).style.backgroundColor="";
		document.all.zh.value=document.all.zh.value.replace(m2,"");
	}
}

function Seldx(org){
	var obj=document.all("Seldx"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang++;
		document.all("Seldx0").style.backgroundColor="";
		document.all("Seldx1").style.backgroundColor="";
		document.all("Seldx2").style.backgroundColor="";
		document.all("Seldx3").style.backgroundColor="";
		document.all("Seldx4").style.backgroundColor="";
		document.all("Seldx5").style.backgroundColor="";
		document.all("Seldx6").style.backgroundColor="";
		document.all("Seldx7").style.backgroundColor="";
		document.all("Seldx"+org).style.backgroundColor="#f05000";
		m2=m6[m];
		document.all.dx.value=m2;
	}else{
		$xuang--;
		document.all("Seldx"+org).style.backgroundColor="";
		document.all.dx.value=document.all.dx.value.replace(m2,"");
	}
}

function Selkd(org){
	var obj=document.all("Selkd"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		document.all("Selkd0").style.backgroundColor="";
		document.all("Selkd1").style.backgroundColor="";
		document.all("Selkd2").style.backgroundColor="";
		document.all("Selkd3").style.backgroundColor="";
		document.all("Selkd4").style.backgroundColor="";
		document.all("Selkd5").style.backgroundColor="";
		document.all("Selkd6").style.backgroundColor="";
		document.all("Selkd7").style.backgroundColor="";
		document.all("Selkd8").style.backgroundColor="";
		document.all("Selkd9").style.backgroundColor="";
		document.all("Selkd"+org).style.backgroundColor="#f05000";
		document.all.kd.value=m;
	}else{
		document.all("Selkd"+org).style.backgroundColor="";
		document.all.kd.value=document.all.kd.value.replace(m,"");
	}
}