function uploadJfkLotterySsl(textareaId,singleSslType){
	var context = document.getElementById(textareaId).value;
	if(isNull(context)){
		alert("请输入上传内容");
		return false;
	}else{
		//alert("check");
		if(NumCheck(context,singleSslType))
		{
			return true;
		}else{
			return false;
		}
	}
}

//返回传入数据的不重复数据[]
function isRepeat(str){
	//alert(str);
	var str1 = "";
	for(var i=0;i<str.length;i++){
		if (str1.indexOf(str[i]) < 0) {
          //将产生的每一组数字之间用空格符号隔开
          str1 += str[i]+" ";
      	}
	}
	var strT = str1.replace(/^(\s)*|(\s)*$/g,"").split(" ");
	return strT;
}


//校验号码格式
function isSslDigit(s,singleSslType)
{
	//alert(singleSslType);
	
	if(s.indexOf(",")<0){
		alert('球与球之间需要用,隔开');
		return false;
	}
	
	/*if(s.indexOf("[")<0 || s.indexOf("]")<0 ){
		alert('单注投注格式必须加上投注类型[ ]');
		return false;
	}*/
	
	var patrn=/^[0-9]{1,1}$/;
	
	var singleSsl = s.replace(/^(\s)*|(\s)*$/g,"");//单注球
	//var singleSslType = s.substr(s.indexOf("["), s.indexOf("]")).replace(/^(\s)*|(\s)*$/g,"");//投注方式
	//alert(singleSslType);
	var singleSslBall = singleSsl.split(",");
	
	if(singleSslBall.length!=3){
		alert('单注投注球数必须为3个');
		return false;
	}
	
	for(var j=0;j<singleSslBall.length;j++)
	if(!patrn.exec(singleSslBall[j])){
		alert('球格式不符');
		return false;
	}
	
	//alert(singleSslType);
	
	if(singleSslType=="1"){
			//不需要判断
	}else if(singleSslType=="2"){
		//组3必须包括2个不同球
		if(isRepeat(singleSslBall).length!=2){
			alert('组3 必须包含2个不同球');
			return false;
		}
	}else if(singleSslType=="3"){
		//组6必须包含3个不同球
		if(isRepeat(singleSslBall).length!=3){
			alert('组6 必须包含3个不同球');
			return false;
		}
	}else{
		alert('投注类型有误');
		return false;
	}
	
	return true;
}

//检查投注格式是否正确
function NumCheck(context,singleSslType)
{
    while(context.indexOf("\r")!=-1){context=context.replace("\r","");}
    if(context.substr(context.length-1,1)=="\n")
	{
		context = context.substr(0,context.length-1);
	}
	
	var t=context.split("\n");
	var j=0;
	for(var i=0;i<t.length;i++)
	{
	   //alert(t[i]);
	   if(!isSslDigit(t[i],singleSslType))//校验格式是否正确
	   {
			alert('对不起，数据:'+t[i]+'格式不对！\r\n'+'提示：\r\n'+'1,2,3[直选]');
			j=j+1;
	   }else{
	   		//排序
	   		var singleSsl = t[i].replace(/^(\s)*|(\s)*$/g,"");//单注球
			//var singleSslType = t[i].substr(t[i].indexOf("["), t[i].indexOf("]")).replace(/^(\s)*|(\s)*$/g,"");//投注方式
	   		
	   		singleSsl = singleSsl.split(",").sort().toString().replace(/,/g,",");
	   		var single = singleSsl.split(",");
	   		
	   		var singleSslTypeId = 0;
	   		
	   		var singleSslType1 = "";
	   		
	   		if(singleSslType=="1"){
	   			
	   			singleSslTypeId = 1 ;
	   			singleSslType1 = "[直选]" ;
	   			
	   		}else if(singleSslType=="2"){
	   			
	   			singleSslTypeId = 2 ;
	   			singleSslType1 = "[组3]" ;
	   			
	   		}else if(singleSslType=="3"){
	   			
	   			singleSslTypeId = 3 ;
	   			singleSslType1 = "[组6]" ;
	   		}
	   		
	   		//插入投注列表中
	   		optionValue="" + singleSsl+":2:"+singleSslTypeId+":1:1";
			optionText="" + single[0] + "," + single[1] + "," + single[2] + " "+singleSslType1+" [1倍]";
	   		newOption(optionText,optionValue);
	   		total();
	   }
	}
	if(j==0){
		return true;
	}else{
		return false;
	}
}

function isNull(str) {
	str=strTrim(str);
	if(str.length==0){	return true;}
	return false;
}