function Build(N){
if(N<10){
return "0"+N;
}else{
return N;
}}
function ForNum(N){
if(N.indexOf("0")==0){
N=N.substr(1);
}
return parseInt(N);
}
function DFL(){
var clean;
this.aArray=new Array(10);
this.bArray=new Array(10);
this.cArray=new Array(10);
this.dArray=new Array(10);
this.eArray=new Array(10);
this.fArray=new Array(10);
this.gArray=new Array(13);
this.nArray=new Array();
this.oArray=new Array(0,0,0,0,0,0,0);
this.isEdit=-1;
this.Double=1;
this.isDraw=false;
this.Items=0;
this.isSelect=-1;
this.sArray=new Array();
this.onDouble=function(arg){
arg=arg||0;
var obj=$$("Double");
if(!this.isDraw){
for(var i=1;i<=50;i++){
obj.add(new Option("加 "+i+" 倍",i));
}
this.isDraw=true;
}
obj[arg].selected=true;
}
this.seDouble=function(){
var obj=$$("Double");
var value=obj[obj.selectedIndex].value;
this.Double=value;
this.onStyle();
}
this.onClick=function(arg){
var value=arg.id;
if(value.indexOf("a")>-1){
value=value.replace("a_","");
if(this.aArray[parseInt(value)]==1){
if(this.isEdit!=-1){
if(this.oArray[0]<=1){
return false;
}}
this.aArray[parseInt(value)]=0;
}else{
this.aArray[parseInt(value)]=1;
}}
if(value.indexOf("b")>-1){
value=value.replace("b_","");
if(this.bArray[parseInt(value)]==1){
if(this.isEdit!=-1){
if(this.oArray[1]<=1){
return false;
}}
this.bArray[parseInt(value)]=0;
}else{
this.bArray[parseInt(value)]=1;
}}
if(value.indexOf("c")>-1){
value=value.replace("c_","");
if(this.cArray[parseInt(value)]==1){
if(this.isEdit!=-1){
if(this.oArray[2]<=1){
return false;
}}
this.cArray[parseInt(value)]=0;
}else{
this.cArray[parseInt(value)]=1;
}}
if(value.indexOf("d")>-1){
value=value.replace("d_","");
if(this.dArray[parseInt(value)]==1){
if(this.isEdit!=-1){
if(this.oArray[3]<=1){
return false;
}}
this.dArray[parseInt(value)]=0;
}else{
this.dArray[parseInt(value)]=1;
}}
if(value.indexOf("e")>-1){
value=value.replace("e_","");
if(this.eArray[parseInt(value)]==1){
if(this.isEdit!=-1){
if(this.oArray[4]<=1){
return false;
}}
this.eArray[parseInt(value)]=0;
}else{
this.eArray[parseInt(value)]=1;
}}
if(value.indexOf("f")>-1){
value=value.replace("f_","");
if(this.fArray[parseInt(value)]==1){
if(this.isEdit!=-1){
if(this.oArray[5]<=1){
return false;
}}
this.fArray[parseInt(value)]=0;
}else{
this.fArray[parseInt(value)]=1;
}}
if(value.indexOf("g")>-1){
value=value.replace("g_","");
if(value>=1){
if(this.gArray[parseInt(value)]==1){
if(this.isEdit!=-1){
if(this.oArray[6]<=1){
return false;
}}
this.gArray[parseInt(value)]=0;
}else{
this.gArray[parseInt(value)]=1;
}}}
this.onStyle();
}
this.ClArray=function(){
for(var i=0;i<7;i++){
this.oArray[i]=0;
}}
this.onStyle=function(){
this.ClArray();
for(var i=0;i<10;i++){
if(this.aArray[i]==1){
$$("a_"+i).className="BB";
this.oArray[0]++;
}else{
$$("a_"+i).className="GB";
}
if(this.bArray[i]==1){
$$("b_"+i).className="BB";
this.oArray[1]++;
}else{
$$("b_"+i).className="GB";
}
if(this.cArray[i]==1){
$$("c_"+i).className="BB";
this.oArray[2]++;
}else{
$$("c_"+i).className="GB";
}
if(this.dArray[i]==1){
$$("d_"+i).className="BB";
this.oArray[3]++;
}else{
$$("d_"+i).className="GB";
}
if(this.eArray[i]==1){
$$("e_"+i).className="BB";
this.oArray[4]++;
}else{
$$("e_"+i).className="GB";
}
if(this.fArray[i]==1){
$$("f_"+i).className="BB";
this.oArray[5]++;
}else{
$$("f_"+i).className="GB";
}
if(i>0){
if(this.gArray[i]==1){
$$("g_"+i).className="RB";
this.oArray[6]++;
}else{
$$("g_"+i).className="GB";
}}}
for(var i=10;i<13;i++){
if(this.gArray[i]==1){
$$("g_"+i).className="RB";
this.oArray[6]++;
}else{
$$("g_"+i).className="GB";
}}
this.onOut();
}
this.onCompute=function(){
this.Items=(this.oArray[0]*this.oArray[1]*this.oArray[2]*this.oArray[3]*this.oArray[4]*this.oArray[5]*this.oArray[6]);
}
this.onOut=function(){
this.onCompute();
var Obj=$$("d");
Obj.innerHTML="当前选号："+this.Items+"&nbsp;注，"+this.Double+"&nbsp;倍，金额："+this.Items*2*this.Double+"<span class=sMoney>.00</span>";
if(this.isEdit!=-1){
this.onInArray();
}}
this.onInArray=function(){
var A=null,B=null,C=null,D=null,E=null,F=null,G=null
for(var i=0;i<10;i++){
if(this.aArray[i]==1){
if(A==null){
A=i;
}else{
A=A+"-"+i;
}}
if(this.bArray[i]==1){
if(B==null){
B=i;
}else{
B=B+"-"+i;
}}
if(this.cArray[i]==1){
if(C==null){
C=i;
}else{
C=C+"-"+i;
}}
if(this.dArray[i]==1){
if(D==null){
D=i;
}else{
D=D+"-"+i;
}}
if(this.eArray[i]==1){
if(E==null){
E=i;
}else{
E=E+"-"+i;
}}
if(this.fArray[i]==1){
if(F==null){
F=i;
}else{
F=F+"-"+i;
}}
if(i>0){
if(this.gArray[i]==1){
if(G==null){
G=Build(i);
}else{
G=G+"-"+Build(i);
}}}}
for(var i=10;i<13;i++){
if(this.gArray[i]==1){
if(G==null){
G=Build(i);
}else{
G=G+"-"+Build(i);
}}}
if(A!=null&&B!=null&&C!=null&&D!=null&&E!=null&&F!=null&&G!=null){
if(this.isEdit==-1){
var Len=this.nArray.length;
this.nArray[Len]=new Array(A+","+B+","+C+","+D+","+E+","+F+"+"+G,this.Double)
}else{
this.nArray[this.isEdit]=new Array(A+","+B+","+C+","+D+","+E+","+F+"+"+G,this.Double)
var Para="DFContent";
var Obj=$$(Para);
Obj[this.isSelect].value=this.isEdit+"+"+this.nArray[this.isEdit][0]+"+"+this.nArray[this.isEdit][1];
Obj[this.isSelect].text=this.nArray[this.isEdit][0]+"　　×"+this.nArray[this.isEdit][1];
return;
}}else{
return;
}
this.onList();
}
this.onList=function(){
var Para="DFContent";
this.clList(Para);
var Para=$$(Para);
var Len=this.nArray.length;
var Temp,Temp_;
for(var i=0;i<Len;i++){
if(this.nArray[i]!=null){
Temp=i+"+"+this.nArray[i][0]+"+"+this.nArray[i][1];
Temp_=this.nArray[i][0]+"　　×"+this.nArray[i][1];
Para.add(new Option(Temp_,Temp));
}}
this.clAll();
}
this.clList=function(arg){
var Obj=$$(arg);
var Len=Obj.length;
for(var i=Len-1;i>=0;i--){
Obj.remove(i);
}}
this.clAll=function(){
this.aArray=new Array(10);
this.bArray=new Array(10);
this.cArray=new Array(10);
this.dArray=new Array(10);
this.eArray=new Array(10);
this.fArray=new Array(10);
this.gArray=new Array(12);
this.Double=1;
this.onDouble();
this.onStyle();
}
this.onChange=function(Obj){
			if (clean==Obj.options.selectedIndex){
	this.onBlur();
			} else {
	clean=Obj.options.selectedIndex;
this.clAll();
var Obj=Obj.options;
this.isSelect=Obj.selectedIndex;
var value=Obj[this.isSelect].value;
var Arr=value.split("+");
this.isEdit=parseInt(Arr[0]);
var TempArr=Arr[1];
var SubArr=TempArr.split(",");
var len=0;
var sub;
for(var i=0;i<6;i++){
sub=SubArr[i].split("-");
len=sub.length;
for(var k=0;k<len;k++){
if(i==0){this.aArray[parseInt(sub[k])]=1;}
if(i==1){this.bArray[parseInt(sub[k])]=1;}
if(i==2){this.cArray[parseInt(sub[k])]=1;}
if(i==3){this.dArray[parseInt(sub[k])]=1;}
if(i==4){this.eArray[parseInt(sub[k])]=1;}
if(i==5){this.fArray[parseInt(sub[k])]=1;}
}}
var SArr=Arr[2].split('-');
len=SArr.length;
for(var i=0;i<len;i++){
this.gArray[ForNum(SArr[i])]=1;
}
this.Double=parseInt(Arr[3]);
this.onDouble(this.Double-1);
this.onStyle();
}}
this.onDel=function(){
if(this.isEdit==-1) return;
this.nArray[this.isEdit]=null;
this.isEdit=-1;
this.onList();
}
this.Clean=function(){
this.isEdit=-1;
this.nArray=new Array();
this.onList();
}
this.onBlur=function(){
clean=-1;
this.isEdit=-1;
this.onList();
}
this.RndNumber=function(Min,Max){
var TempObj=Math.round(Min+Math.random()*(Max-Min));
return TempObj;
}
this.onRnd=function(arg){
var A=-1,B=-1,C=-1,D=-1,E=-1,F=-1,G=-1
var H,I,J,K,L,M,N
for(var i=0;i<10;i++){
if(this.aArray[i]==1){A=","+i;}
if(this.bArray[i]==1){B=","+i;}
if(this.cArray[i]==1){C=","+i;}
if(this.dArray[i]==1){D=","+i;}
if(this.eArray[i]==1){E=","+i;}
if(this.fArray[i]==1){F=","+i;}
if(i>0 && this.gArray[i]==1){G=","+i;}
}
for(var i=11;i<12 ;i++ ){
if(this.gArray[i]==1){G=","+i;}
}
if(typeof(A)=="string" && A.substr(1).indexOf(",")>-1){
A=-1,B=-1,C=-1,D=-1,E=-1,F=-1,G=-1;
}
if(typeof(B)=="string" && B.substr(1).indexOf(",")>-1){
A=-1,B=-1,C=-1,D=-1,E=-1,F=-1,G=-1;
}
if(typeof(C)=="string" && C.substr(1).indexOf(",")>-1){
A=-1,B=-1,C=-1,D=-1,E=-1,F=-1,G=-1;
}
if(typeof(D)=="string" && D.substr(1).indexOf(",")>-1){
A=-1,B=-1,C=-1,D=-1,E=-1,F=-1,G=-1;
}
if(typeof(E)=="string" && E.substr(1).indexOf(",")>-1){
A=-1,B=-1,C=-1,D=-1,E=-1,F=-1,G=-1;
}
if(typeof(F)=="string" && F.substr(1).indexOf(",")>-1){
A=-1,B=-1,C=-1,D=-1,E=-1,F=-1,G=-1;
}
if(typeof(G)=="string" && G.substr(1).indexOf(",")>-1){
A=-1,B=-1,C=-1,D=-1,E=-1,F=-1,G=-1;
}
this.isEdit=-1;
this.clAll();
this.nArray=new Array();
for(var i=0;i<arg;i++){
if(A==-1){
H=this.RndNumber(0,9);
}else{
H=A.substr(1);
}
if(B==-1){
I=this.RndNumber(0,9);
}else{
I=B.substr(1);
}
if(C==-1){
J=this.RndNumber(0,9);
}else{
J=C.substr(1);
}
if(D==-1){
K=this.RndNumber(0,9);
}else{
K=D.substr(1);
}
if(E==-1){
L=this.RndNumber(0,9);
}else{
L=E.substr(1);
}
if(F==-1){
M=this.RndNumber(0,9);
}else{
M=F.substr(1);
}
if(G==-1){
N=Build(this.RndNumber(1,12));

}else{
N=G.substr(1);
if(N<10){
	N="0"+N;
	}
}

this.nArray[i]=new Array(H+","+I+","+J+","+K+","+L+","+M+"+"+N,"1");
}
this.onList();
}
this.reData=function(arg){
if(arg=="") return;
this.clAll();
this.nArray=new Array();
var TArr=arg.split("|");
var Arr;
var Len=TArr.length;
var SubArr=null;
for(var i=0;i<Len;i++){
Arr=TArr[i].split("×");
this.nArray[this.nArray.length]=new Array(Arr[0],Arr[1]);
}
this.onList();
}
this.getData=function(){
var Len=this.nArray.length;
var TempStr="";
for(var i=0;i<Len;i++){
if(this.nArray[i]!=null){
TempStr+="|"+this.nArray[i][0]+"×"+this.nArray[i][1];
}}
if(TempStr==""){
return false;
}else{
$$("Content").value=TempStr.substr(1);
return true;
}};
}
var DF=new DFL();