var SelRedball=0;
var JCRedball=0;
var SelBlueball=0;
var JCBlueball=0;
var $xuang=0;
var $xuang1=0;
var $xuang2=0;
var $xuang3=0;
var m3 = new Array();//创建一个新的数组
m3[1] = "80以下";
m3[2] = "81-90之间";
m3[3] = "91-100之间";
m3[4] = "101-110之间";
m3[5] = "111-120之间";
m3[6] = "121-130之间";
m3[7] = "130以上";
var m4 = new Array();//创建一个新的数组
m4[1] = "首位奇数，尾位奇数";
m4[2] = "首位奇数，尾位偶数";
m4[3] = "首位偶数，尾位奇数";
m4[4] = "首位偶数，尾位偶数";
function Selhq(org){
	var obj=document.all("Selhq"+org).style.backgroundColor;
	if (org<10){
		m="0"+org;
	}else{
		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 JChq(org){
	var obj=document.all("JChq"+org).style.backgroundColor;
	if (org<10){
		m="0"+org;
	}else{
		m=org;
	}
	if(org=="110"){
		$xuang1=0;
		JCRedball=0;
		for($i=1; $i<=33; $i++){
			document.all("JChq"+$i).style.backgroundColor="";
			document.all("JCh"+$i).style.backgroundColor="";
			document.all("JChqb"+$i).checked=false;
			document.all("JChb"+$i).checked=false;
		}//循环
		document.all.hq.value="";
	}else if(obj==""){
		$xuang1=1;
		JCRedball++;
		if(JCRedball>=13){
			alert("红球最多只能选择12个！");
			JCRedball--;
			return;
		}
		document.all("JChqb"+org).checked=document.all("JChqb"+org).checked==true?false:true;
		document.all("JChb"+org).checked=document.all("JChb"+org).checked==true?false:true;
		document.all("JChq"+org).style.backgroundColor="#f05000";
		document.all("JCh"+org).style.backgroundColor="#f05000";
		document.all.hq.value=document.all.hq.value+" "+m;
	}else{
		$xuang1=0;
		document.all("JChqb"+org).checked=document.all("JChqb"+org).checked==true?false:true;
		document.all("JChb"+org).checked=document.all("JChb"+org).checked==true?false:true;
		document.all("JChq"+org).style.backgroundColor="";
		document.all("JCh"+org).style.backgroundColor="";
		document.all.hq.value=document.all.hq.value.replace(" "+m,""); 
		JCRedball--;
	}
}

function JClq(org){
	var obj=document.all("JClq"+org).style.backgroundColor;
	if (org<10){
		m="0"+org;
	}else{
		m=org;
	}
	if(org=="110"){
		$xuang1=0;
		JCBlueball=0;
		for($i=1; $i<=16; $i++){
			document.all("JClq"+$i).style.backgroundColor="";
			document.all("JCl"+$i).style.backgroundColor="";
			document.all("JClqb"+$i).checked=false;
			document.all("JClb"+$i).checked=false;
		}//循环
		document.all.lq.value="";
	}else if(obj==""){
		$xuang1=1;
		JCBlueball++;
		if(JCBlueball>=5){
			alert("蓝球最多只能选择4个！");
			JCBlueball--;
			return;
		}
		document.all("JClqb"+org).checked=document.all("JClqb"+org).checked==true?false:true;
		document.all("JClb"+org).checked=document.all("JClb"+org).checked==true?false:true;
		document.all("JClq"+org).style.backgroundColor="#f05000";
		document.all("JCl"+org).style.backgroundColor="#f05000";
		document.all.lq.value=document.all.lq.value+" "+m;
	}else{
		$xuang1=0;
		document.all("JClqb"+org).checked=document.all("JClqb"+org).checked==true?false:true;
		document.all("JClb"+org).checked=document.all("JClb"+org).checked==true?false:true;
		document.all("JClq"+org).style.backgroundColor="";
		document.all("JCl"+org).style.backgroundColor="";
		document.all.lq.value=document.all.lq.value.replace(" "+m,""); 
		JCBlueball--;
	}
}

function Sellq(org){
	var obj=document.all("Sellq"+org).style.backgroundColor;
	if (org<10){
		m="0"+org;
	}else{
		m=org;
	}
	if(obj==""){
		$xuang2=1;
		SelBlueball++;
		if(SelBlueball>=13){
			alert("杀码最多只能选择12个！");
			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 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("Selqs"+org).style.backgroundColor="#f05000";
		m2="奇偶比："+m+" ："+(6-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 Selxs(org){
	var obj=document.all("Selxs"+org).style.backgroundColor;
	m=org;
	if(obj=="" && m <= 6){
		m2=m;
		document.all("Selxs0").style.backgroundColor="";
		document.all("Selxs1").style.backgroundColor="";
		document.all("Selxs2").style.backgroundColor="";
		document.all("Selxs3").style.backgroundColor="";
		document.all("Selxs4").style.backgroundColor="";
		document.all("Selxs5").style.backgroundColor="";
		document.all("Selxs6").style.backgroundColor="";
		document.all("Selxs"+org).style.backgroundColor="#f05000";
		document.all.xs1.value=m2;
	}else if(m <= 6){
		m2=m;
		document.all("Selxs"+org).style.backgroundColor="";
		document.all.xs1.value=document.all.xs1.value.replace(m2,"");
	}
	
	if(obj=="" && m >= 7 && m <= 13){
		m2=m-7;
		document.all("Selxs7").style.backgroundColor="";
		document.all("Selxs8").style.backgroundColor="";
		document.all("Selxs9").style.backgroundColor="";
		document.all("Selxs10").style.backgroundColor="";
		document.all("Selxs11").style.backgroundColor="";
		document.all("Selxs12").style.backgroundColor="";
		document.all("Selxs13").style.backgroundColor="";
		document.all("Selxs"+org).style.backgroundColor="#f05000";
		document.all.xs2.value=m2;
	}else if(m >= 7 && m <= 13){
		m2=m-7;
		document.all("Selxs"+org).style.backgroundColor="";
		document.all.xs2.value=document.all.xs2.value.replace(m2,"");
	}
	
	if(obj=="" && m >= 14 && m <= 20){
		m2=m-14;
		document.all("Selxs14").style.backgroundColor="";
		document.all("Selxs15").style.backgroundColor="";
		document.all("Selxs16").style.backgroundColor="";
		document.all("Selxs17").style.backgroundColor="";
		document.all("Selxs18").style.backgroundColor="";
		document.all("Selxs19").style.backgroundColor="";
		document.all("Selxs20").style.backgroundColor="";
		document.all("Selxs"+org).style.backgroundColor="#f05000";
		document.all.xs3.value=m2;
	}else if(m >= 14 && m <= 20){
		m2=m-14;
		document.all("Selxs"+org).style.backgroundColor="";
		document.all.xs3.value=document.all.xs3.value.replace(m2,"");
	}
}

	
function Seljchz(org){
	var obj=document.all("Seljchz"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang++;
		document.all("Seljchz1").style.backgroundColor="";
		document.all("Seljchz2").style.backgroundColor="";
		document.all("Seljchz3").style.backgroundColor="";
		document.all("Seljchz4").style.backgroundColor="";
		document.all("Seljchz5").style.backgroundColor="";
		document.all("Seljchz6").style.backgroundColor="";
		document.all("Seljchz7").style.backgroundColor="";
		document.all("Seljchz"+org).style.backgroundColor="#f05000";
		m2="和值在"+m3[m];
		document.all.jchz.value=m2;
	}else{
		$xuang--;
		document.all("Seljchz"+org).style.backgroundColor="";
		document.all.jchz.value=document.all.jchz.value.replace(m2,"");
	}
}

function Seljcch(org){
	var obj=document.all("Seljcch"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang++;
		document.all("Seljcch0").style.backgroundColor="";
		document.all("Seljcch1").style.backgroundColor="";
		document.all("Seljcch2").style.backgroundColor="";
		document.all("Seljcch3").style.backgroundColor="";
		document.all("Seljcch"+org).style.backgroundColor="#f05000";
		m2="重号："+m+"个";
		document.all.jcch.value=m2;
	}else{
		$xuang--;
		document.all("Seljcch"+org).style.backgroundColor="";
		document.all.jcch.value=document.all.jcch.value.replace(m2,"");	 
	}
}


function Seljclh(org){
	var obj=document.all("Seljclh"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang++;
		document.all("Seljclh0").style.backgroundColor="";
		document.all("Seljclh2").style.backgroundColor="";
		document.all("Seljclh3").style.backgroundColor="";
		document.all("Seljclh"+org).style.backgroundColor="#f05000";
		m2="连号："+m+"连号";
		document.all.jclh.value=m2;
	}else{
		$xuang--;
		document.all("Seljclh"+org).style.backgroundColor="";
		document.all.jclh.value=document.all.jclh.value.replace(m2,"");	 
	}
}

function Seljctwh(org){
	var obj=document.all("Seljctwh"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang++;
		document.all("Seljctwh0").style.backgroundColor="";
		document.all("Seljctwh1").style.backgroundColor="";
		document.all("Seljctwh2").style.backgroundColor="";
		document.all("Seljctwh"+org).style.backgroundColor="#f05000";
		m2="同尾号："+m+"组";
		document.all.jctwh.value=m2;
	}else{
		$xuang--;
		document.all("Seljctwh"+org).style.backgroundColor="";
		document.all.jctwh.value=document.all.jctwh.value.replace(m2,"");	 
	}
}


function Seljcsw(org){
	var obj=document.all("Seljcsw"+org).style.backgroundColor;
	m=org;
	if(obj==""){
		$xuang++;
		document.all("Seljcsw1").style.backgroundColor="";
		document.all("Seljcsw2").style.backgroundColor="";
		document.all("Seljcsw3").style.backgroundColor="";
		document.all("Seljcsw4").style.backgroundColor="";
		document.all("Seljcsw"+org).style.backgroundColor="#f05000";
		m2=m4[m];
		document.all.jcsw.value=m2;
	}else{
		$xuang--;
		document.all("Seljcsw"+org).style.backgroundColor="";
		document.all.jcsw.value=document.all.jcsw.value.replace(m2,"");	 
	}
}
