function i3D(){
	var clean;

this.nArray=new Array(25);
this.cArray=new Array();
this.sArray=new Array();
this.isEdit=-1;
this.Items=0;
this.Double=1;
this.isSelect=-1;
this.isDraw=false;
this.onDouble=function(arg){
arg=arg||0;
var obj=$$("Double7");
if(!this.isDraw){
for(var i=1;i<=50;i++){
obj.add(new Option("加 "+i+" 倍",i));
}
this.isDraw=true;
}
obj[arg].selected=true;
}
this.onClick=function(arg){
var value=arg.id;
value=value.replace("i3D_","");
if(this.nArray[parseInt(value)]==1){
if(this.isEdit!=-1){
if(this.cArray.length<=1){
OpenDiv("/Order/ErrType/7.html");
return;
}}
this.nArray[parseInt(value)]=0;
}else{
this.nArray=new Array(25);
this.nArray[parseInt(value)]=1;
}
this.onStyle();
}
this.onStyle=function(){
this.clTotal();
for(var i=3;i<25;i++){
if(this.nArray[i]==1){
this.onTotal(i);
$$("i3D_"+i).className="BB";
}else{
$$("i3D_"+i).className="GB";
}}
this.onOut();
if(this.isEdit!=-1){
this.Edit();
}}
this.onTotal=function(arg){
var Len=this.cArray.length;
this.cArray[Len]=arg;
}
this.clTotal=function(){
this.cArray=new Array();
}
this.onCompute=function(A){
if(A<3 || A>24) return 0;
var Tot=0;
var k,l
for(var i=0;i<=9;i++){
for(k=i;k<=9;k++){
for(l=k;l<=9;l++){
if(i!=k && i!=l && k!=l){
if((i+k+l)==A) {
Tot++;
}}}}}
return Tot;
}
this.onOut=function(){
var Len=this.cArray.length;
this.Items=0;
for(var i=0;i<Len;i++){
this.Items+=this.onCompute(this.cArray[i]);
}
var Obj=$$("d7");
Obj.innerHTML="当前选号：<span class='tre tb'>"+this.Items+"</span>&nbsp;注， <span class='tre tb'>"+this.Double+"</span>&nbsp;倍，金额： <span class='tre tb'>"+this.Items*2*this.Double+"</span>元";
}
this.onInArray=function(){
if(this.isEdit!=-1) return;
if(this.cArray.length<=0) return;
var Len=this.cArray.length;
var ELen=this.sArray.length;
var Temp=null;
for(var i=0;i<Len;i++){
if(Temp==null){
Temp=this.cArray[i];
}else{
Temp=Temp+","+this.cArray[i];
}}
this.sArray[ELen]=new Array(Temp,this.Double);
this.onIn();
}
this.onIn=function(){
var arg="i3DContent";
this.clIn(arg);
var obj=$$(arg);
var Len=this.sArray.length;
var Text,Value;
for(var i=0;i<Len;i++){
if(this.sArray[i]!=null){
Text=this.sArray[i][0]+"　　×"+this.sArray[i][1];
Value=i+"|"+this.sArray[i][0]+"|"+this.sArray[i][1];
obj.add(new Option(Text,Value));
}}
this.clAll();
}
this.clIn=function(arg){
var obj=$$(arg);
var Len=obj.length;
for(var i=Len-1;i>=0;i--){
obj.remove(i);
}}
this.Edit=function(){
var Len=this.cArray.length;
var Temp=null;
for(var i=0;i<Len;i++){
if(Temp==null){
Temp=this.cArray[i];
}else{
Temp=Temp+","+this.cArray[i];
}}
this.sArray[this.isEdit]=new Array(Temp,this.Double);
var arg="i3DContent";
var obj=$$(arg);
obj[this.isSelect].value=this.isEdit+"|"+Temp+"|"+this.Double;
obj[this.isSelect].text=Temp+"　　×"+this.Double;
}
this.clAll=function(){
for(var i=3;i<25;i++){
this.nArray[i]=0;
}
this.Double=1;
this.onDouble();
if(this.isEdit==-1){
this.onStyle();
}}
this.onChange=function(arg){
	if (clean==arg.options.selectedIndex){
	this.onBlur();
			} else {
	clean=arg.options.selectedIndex;
this.clAll();
var obj=arg.options;
this.isSelect=obj.selectedIndex;
var value=obj[this.isSelect].value;
var Arr=value.split("|");
this.isEdit=parseInt(Arr[0]);
this.Double=Arr[2];
this.onDouble(this.Double-1);
var Temp=Arr[1].split(",");
var Len=Temp.length;
this.clTotal();
for(var i=0;i<Len;i++){
this.cArray[i]=Temp[i];
this.nArray[parseInt(Temp[i])]=1;
}
this.onStyle();
}}
this.onDel=function(){
if(this.isEdit==-1) return;
this.sArray[this.isEdit]=null;
this.isEdit=-1;
this.onIn();
}
this.seDouble=function(){
var obj=$$("Double7");
var value=obj[obj.selectedIndex].value;
this.Double=value;
this.onStyle();
if(this.isEdit!=-1){
this.Edit();
}}
this.Clean=function(){
this.isEdit=-1;
this.sArray=new Array();
this.onIn();
}
this.onBlur=function(){
	clean=-1;

this.isEdit=-1;
this.onIn();
}
this.reData=function(arg){
if(arg=="") return;
this.clAll();
this.sArray=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("×");
SubArr=Arr[0].split(",");
this.sArray[this.sArray.length]=new Array(Arr[0],Arr[1]);
}
this.onIn();
}
this.getData=function(){
var Len=this.sArray.length;
var TempStr="";
for(var i=0;i<Len;i++){
if(this.sArray[i]!=null){
TempStr=TempStr+"|"+this.sArray[i][0]+"×"+this.sArray[i][1];
}}
if(TempStr==""){
OpenDiv("/Order/ErrType/5.html");
return false;
}else{
$$("Content").value=TempStr.substr(1);
return true;
}}}
var i3D=new i3D();