// JavaScript Document
String.prototype.getQueryString = function(name)
{
  var reg = new RegExp("(^|&|\\?)"+ name +"=([^&]*)(&|$)");
  var r = this.match(reg);
  if (r!=null) return unescape(r[2]); return null;
}

function check_sel()
{
	var temp_odd_num,temp_even_num,arr_odd_num,arr_even_num;
	
	temp_odd_num=document.getElementById('dan_num').value;
	temp_even_num=document.getElementById('tuo_num').value;
	
	if(temp_odd_num!="")
	{
		arr_odd_num = temp_odd_num.split('、');
		for (var i=0;i<=arr_odd_num.length-1;i++)
		{
			document.getElementById('dan'+arr_odd_num[i]).className='ball_b';
		}
	}
	
	if(temp_even_num!="")
	{
		arr_even_num = temp_even_num.split('、');
		for (var i=0;i<=arr_even_num.length-1;i++)
		{
			document.getElementById('tuo'+arr_even_num[i]).className='ball_b';
		}
	}
}

function sel_dan_num(dan_num)
{
	var dan_num=dan_num;
	var d="1";
	var arr_dan_num,temp_dan_num,temp_tuo_num;
	
	temp_dan_num=document.getElementById('dan_num').value;
	temp_tuo_num=document.getElementById('tuo_num').value;
	arr_dan_num = temp_dan_num.split('、');
	
	if(temp_tuo_num.indexOf(dan_num)>=0)
	{
		alert('此号码已经作为拖号被选择');
		return false;
	}
	
	if(temp_dan_num == "")
	{
		temp_dan_num = dan_num;
	}
	else
	{
		if(temp_dan_num.indexOf(dan_num)>=0)
		{
			temp_dan_num=temp_dan_num.replace('、'+dan_num,'');
			temp_dan_num=temp_dan_num.replace(dan_num+'、','');
			temp_dan_num=temp_dan_num.replace(dan_num,'');
		}
		else
		{
			if(arr_dan_num.length==parseInt(d))
			{
				alert('您只能选择'+d+'个胆号');
				return false;
			}
			else
			{
				temp_dan_num=temp_dan_num+'、'+dan_num;
			}
		}
	}
	document.getElementById('dan_num').value = temp_dan_num;
	if(document.getElementById('dan'+dan_num).className=='ball_r')
	{
		document.getElementById('dan'+dan_num).className='ball_b';
	}
	else
	{
		document.getElementById('dan'+dan_num).className='ball_r';
	}
}

function sel_tuo_num(even_num)
{
	var even_num=even_num;
	var s="6";
	var arr_even_num,arr_even_num,temp_even_num,temp_dan_num;
	
	temp_even_num=document.getElementById('tuo_num').value;
	temp_dan_num=document.getElementById('dan_num').value;
	arr_even_num = temp_even_num.split('、')
	
	if(temp_dan_num.indexOf(even_num)>=0)
	{
		alert('此号码已经作为胆码被选择');
		return false;
	}
	
	if(temp_even_num == "")
	{
		temp_even_num = even_num;
	}
	else
	{
		if(temp_even_num.indexOf(even_num)>=0)
		{
			temp_even_num=temp_even_num.replace('、'+even_num,'');
			temp_even_num=temp_even_num.replace(even_num+'、','');
			temp_even_num=temp_even_num.replace(even_num,'');
		}
		else
		{
			if(arr_even_num.length==parseInt(s))
			{
				alert('您只能选择'+s+'个拖号');
				return false;
			}
			else
			{
				temp_even_num=temp_even_num+'、'+even_num;
			}
		}
	}
	document.getElementById('tuo_num').value = temp_even_num;
	if(document.getElementById('tuo'+even_num).className=='ball_r')
	{
		document.getElementById('tuo'+even_num).className='ball_b';
	}
	else
	{
		document.getElementById('tuo'+even_num).className='ball_r';
	}
}

<!--杨-->
function Calculation()
{
	var dan_num=document.getElementById("dan_num").value;	//胆码
	var tuo_num=document.getElementById("tuo_num").value;//拖码
	var result=document.getElementById("result");//结果
	var zs = document.getElementById("sId");
	var arr_tuo_num=tuo_num.split("、");
	var temp_result = "";
	var temp = 0;
	for(i=0;i<arr_tuo_num.length;i++)
	{
		for( j=i+1;j<arr_tuo_num.length;j++)
		{
			temp_result=temp_result+dan_num+arr_tuo_num[i]+arr_tuo_num[j]+'\n';
			temp=temp+1;
		}
	}
	temp_result=temp_result+"---------------------"+'\n'+"共"+temp+"注";
	zs.innerHTML="共 "+temp+" 注";
	result.value=temp_result;
}
