var dongyao="";
var upyao=0;

function submit2()
{
	var u,d,c,x,y,l,k;
	var l=document.meihua.qgfs.length;
	for (var i=0;i<l;i++){
		if(document.meihua.qgfs[i].checked){
			qg=i+1;
			break;
		}
	}

	switch (parseInt(qg)){
		case 1 :
			dongyao="";
			upyao=0;
			d = Math.round(Math.random()*7);
			u = Math.round(Math.random()*7);
			c = Math.round(Math.random()*6+0.5);
			upyao=d+u*8;
			dongyao+=c;
			break;
		case 2 :
			dongyao="";
			upyao=0;
			break;
		case 3 :
			dongyao="";
			upyao=0;
			upyao+=(parseInt(document.meihua.Y1.options[document.meihua.Y1.selectedIndex].value) % 2);
			upyao+=(parseInt(document.meihua.Y2.options[document.meihua.Y2.selectedIndex].value) % 2)*2;
			upyao+=(parseInt(document.meihua.Y3.options[document.meihua.Y3.selectedIndex].value) % 2)*4;
			upyao+=(parseInt(document.meihua.Y4.options[document.meihua.Y4.selectedIndex].value) % 2)*8;
			upyao+=(parseInt(document.meihua.Y5.options[document.meihua.Y5.selectedIndex].value) % 2)*16;
			upyao+=(parseInt(document.meihua.Y6.options[document.meihua.Y6.selectedIndex].value) % 2)*32;
			l=document.meihua.dy.length;
			for (var i=0;i<l;i++){
				if(document.meihua.dy[i].checked){
					dongyao+=document.meihua.dy[i].value;
					break;
				}
			}
			break;
		case 4 :
			dongyao="";
			upyao=0;
			x=parseInt(document.meihua.num.value,10);
			if(x==NaN) x=Math.round(Math.random()*100000);
			if(x%6==0) k=6;
			dongyao+=k;
			y=x.toString();
			if(y.length<2) y+=Math.round(Math.random()*10000);
			l=Math.round((y.length)/2)-1;
			d=parseInt(y.substr(0,l),10)%8;
			u=parseInt(y.substr(l,y.length-1),10)%8;
			upyao=d+u*8;
			break;
		case 5 :
			dongyao="";
			upyao=0;
			d=parseInt(document.meihua.num_down.value,10)%8;
			if(d==NaN) d=Math.round(Math.random()*100000)%8;
			u=parseInt(document.meihua.num_up.value,10)%8;
			if(u==NaN) u=Math.round(Math.random()*100000)%8;
			if((d+u)%6==0) dongyao+=6;
			else dongyao+=(d+u)%6;
			upyao=(u%8)*8+(d%8);
			break;
	}
	document.meihua.val.value=""+dongyao+"|"+upyao;
	dongyao="";
	upyao=0;
	Window.form1.submit();
}

