thepage="Atomic Theory - Nuclear Decay"
masscell=new Array("<sup><input type=text size=2 name=mass0></sup>","<sup><input type=text size=2 name=mass1></sup>","<sup><input type=text size=2 name=mass2></sup>")
pcell=new Array("<sub><input type=text size=2 name=prot0></sub>","<sub><input type=text size=2 name=prot1></sub>","<sub><input type=text size=2 name=prot2></sub>")
tosubmit="<br><input type=button value='Check Answer' onClick=answer(this.form)></form>"
thepage="Nuclear Decay(37)"
atom=new Array();
particles=new Array()
particles[0]=new Array("&alpha;",2,4)
particles[1]=new Array("&beta;","+","0")
particles[2]=new Array("&beta;","-","0")
atom[1]=new Array("hydrogen","H",1,1,2,3)
atom[2]=new Array("helium","He",2,3,4,6)
atom[3]=new Array("lithium","Li",3,6,7,8)
atom[4]=new Array("beryllium","Be",4,9,10,11)
atom[5]=new Array("boron","B",5,8,10,11)
atom[6]=new Array("carbon","C",6,12,13,14)
atom[7]=new Array("nitrogen","N",7,14,15,16)
atom[8]=new Array("oxygen","O",8,16,17,18)
atom[9]=new Array("fluorine","F",9,17,18,19)
atom[10]=new Array("neon","Ne",10,20,21,22)
atom[11]=new Array("sodium","Na",11,22,23,24)
atom[12]=new Array("magnesium","Mg",12,24,25,26)
atom[13]=new Array("aluminum","Al",13,26,27,28)
atom[14]=new Array("silicon","Si",14,28,29,30)
atom[15]=new Array("phosphorous","P",15,30,31,32)
atom[16]=new Array("sulfur","S",16,32,33,34)
atom[17]=new Array("chlorine","Cl",17,35,36,37)
atom[18]=new Array("argon","Ar",18,39,40,41)
atom[19]=new Array("potassium","K",19,39,40,41)
atom[20]=new Array("calcium","Ca",20,40,42,44)
atom[21]=new Array("scandium","Sc",21,44,45,46)
atom[22]=new Array("titanium","Ti",22,46,47,48)
atom[23]=new Array("vanadium","V",23,50,51,52)
atom[24]=new Array("chromium","Cr",24,52,53,54)
atom[25]=new Array("manganese","Mn",25,54,55,56)
atom[26]=new Array("iron","Fe",26,54,56,57)
atom[27]=new Array("cobalt","Co",27,58,59,60)
atom[28]=new Array("nickel","Ni",28,58,60,62)
atom[29]=new Array("copper","Cu",29,63,64,65)
atom[30]=new Array("zinc","Zn",30,64,66,68)
atom[31]=new Array("gallium","Ga",31,69,70,71)
atom[32]=new Array("germanium","Ge",32,70,72,74)
atom[33]=new Array("arsenic","As",33,74,75,76)
atom[34]=new Array("selenium","Se",34,76,78,80)
atom[35]=new Array("bromine","Br",35,79,80,81)
atom[36]=new Array("krypton","Kr",36,83,84,86)
atom[37]=new Array("rubidium","Rb",37,85,86,87)
atom[38]=new Array("strontium","Sr",38,86,87,88)
atom[39]=new Array("yttrium","Y",39,88,89,90)
atom[40]=new Array("zirconium","Zr",40,90,92,94)
atom[41]=new Array("niobium","Nb",41,90,93,95)
atom[42]=new Array("molybdenum","Mo",42,95,96,98)
atom[43]=new Array("technetium","Tc",43,101,102,104)
atom[44]=new Array("ruthenium","Ru",44,102,103,104)
atom[45]=new Array("rhodium","Rh",45,103,105,108)
atom[46]=new Array("palladium","Pd",46,105,106,108)
atom[47]=new Array("silver","Ag",47,107,109,110)
atom[48]=new Array("cadmium","Cd",48,112,113,114)
atom[49]=new Array("indium","In",49,113,115,117)
atom[50]=new Array("tin","Sn",50,116,118,120)
atom[51]=new Array("antimony","Sb",51,121,123,125)
atom[52]=new Array("tellurium","Te",52,126,128,130)
atom[53]=new Array("iodine","I",53,126,127,128)
atom[54]=new Array("xenon","Xe",54,129,131,132)
atom[55]=new Array("cesium","Cs",55,132,133,136)
atom[56]=new Array("barium","Ba",56,136,137,138)
atom[57]=new Array("lanthanum","La",57,138,139,140)
atom[58]=new Array("cerium","Ce",58,140,142,144)
atom[59]=new Array("praseodymium","Pr",59,141,143,144)
atom[60]=new Array("neodymium","Nd",60,142,144,145)
atom[61]=new Array("promethium","Pm",61,147,148,150)
atom[62]=new Array("samarium","Sm",62,149,152,154)
atom[63]=new Array("europium","Eu",63,151,153,155)
atom[64]=new Array("gadollinium","Gd",64,156,158,160)
atom[65]=new Array("terbium","Tb",65,158,159,160)
atom[66]=new Array("dysprosium","Dy",66,162,163,164)
atom[67]=new Array("holmium","Ho",67,164,165,166)
atom[68]=new Array("erbium","Er",68,166,167,168)
atom[69]=new Array("thullum","Tm",69,168,169,170)
atom[70]=new Array("ytterbium","Yb",70,172,173,174)
atom[71]=new Array("lutetium","Lu",71,174,174,176)
atom[72]=new Array("hafnium","Hf",72,178,179,180)
atom[73]=new Array("tantalum","Ta",73,180,181,182)
atom[74]=new Array("tungsten","W",74,183,184,186)
atom[75]=new Array("rhenium","Re",75,185,186,187)
atom[76]=new Array("osmium","Os",76,189,190,192)
atom[77]=new Array("iridium","Ir",77,191,192,193)
atom[78]=new Array("platinum","Pt",78,194,195,196)
atom[79]=new Array("gold","Au",79,196,197,198)
atom[80]=new Array("mercury","Hg",80,200,201,202)
atom[81]=new Array("thallium","Tl",81,203,205,207)
atom[82]=new Array("lead","Pb",82,206,207,208)
atom[83]=new Array("bismuth","Bi",83,208,209,210)
atom[84]=new Array("polonium","Po",84,209,210,211)
atom[85]=new Array("astatine","At",85,211,212,213)
atom[86]=new Array("radon","Rn",86,220,222,224)
atom[87]=new Array("francium","Fr",87,221,223,225)  
atom[88]=new Array("radium","Ra",88,225,226,228)
atom[89]=new Array("actinium","Ac",89,227,228,229)
atom[90]=new Array("thorium","Th",90,230,232,234)
atom[91]=new Array("protactinium","Pa",91,234,236,237)
atom[92]=new Array("uranium","U",92,235,238,240)
atom[93]=new Array("neptunium","Np",93,238,240,241)
atom[94]=new Array("plutonium","Pu",94,244,246,247)
atom[95]=new Array("americium","Am",95,243,245,247)
atom[96]=new Array("curium","Cm",96,245,248,250)
atom[97]=new Array("berkelium","Bk",97,249,250,251)
atom[98]=new Array("californium","Cf",98,250,253,254)
atom[99]=new Array("einsteinum","Es",99,252,253.255)
atom[100]=new Array("fermium","Fm",100,256,257,258)
atom[101]=new Array("mendelevium","Md",101,256,257,258)
atom[102]=new Array("nobelium","No",102,252,257,258)
atom[103]=new Array("lawrencium","Lr",103,258,259,260)
theatoms=new Array()
function clear(){
	document.forms[0].results.value=""
	clearansspot()
	tried=0
}
function startit(){
	clear()
	totl++
	document.forms[0].total.value=totl
	option=Math.floor(4*Math.random())
	if(option==0)alpha()
	if(option==1)betaplus()
	if(option==2)betaminus()
	if(option==3)fission()
}	
function alpha(){
	theatoms=new Array()
	first=0
	while(first<10)first=Math.ceil(atom.length*Math.random());
	whichiso=0
	while(whichiso<3)whichiso=Math.floor(Math.random()*atom[first].length);
	theatoms[0]=new Array(atom[first][1],first,atom[first][whichiso])
	theatoms[1]=new Array(atom[first-2][1],first-2,(theatoms[0][2]-4))
	theatoms[2]=particles[0]
	buildquestion()
}
function betaplus(){
	theatoms=new Array()
	first=0
	while(first<10)first=Math.ceil(atom.length*Math.random());
	whichiso=0
	while(whichiso<3)whichiso=Math.floor(Math.random()*atom[first].length);
	theatoms[0]=new Array(atom[first][1],first,atom[first][whichiso])
	theatoms[1]=new Array(atom[first-1][1],first-1,theatoms[0][2])
	theatoms[2]=particles[1]
	buildquestion()
}
function betaminus(){
	theatoms=new Array()
	first=0
	while(first<10)first=Math.ceil(atom.length*Math.random());
	whichiso=0
	while(whichiso<3)whichiso=Math.floor(Math.random()*atom[first].length);
	theatoms[0]=new Array(atom[first][1],first,atom[first][whichiso])
	theatoms[1]=new Array(atom[first+1][1],first+1,theatoms[0][2])
	theatoms[2]=particles[2]
	buildquestion()
}
function fission(){
	theatoms=new Array()
	first=0
	while(first<10)first=Math.ceil(atom.length*Math.random());
	whichiso=0
	while(whichiso<3)whichiso=Math.floor(Math.random()*atom[first].length);
	theatoms[0]=new Array(atom[first][1],first,atom[first][whichiso])
	second=first
	while(second>first-5)second=Math.ceil(first*Math.random())
	whichiso=0
	while(whichiso<3)whichiso=Math.floor(Math.random()*atom[second].length);
	theatoms[1]=new Array(atom[second][1],second,atom[second][whichiso])
	theatoms[2]=new Array(atom[first-second][1],(first-second),(theatoms[0][2]-theatoms[1][2]))
	buildquestion()
}
function buildquestion(){
	getsymbols()
	thequest="Complete the following nuclear process by entering the missing mass and atomic numbers<br /><form>"
	thequest+=thesymbols[0]+" => "+masscell[0]+" <b>X</b> "+pcell[0]+" + "+thesymbols[2]+tosubmit
	showquest(thequest)
	buildanswer()
}
function buildanswer(){
	theanswer=thesymbols[0]+" => "+thesymbols[1]+" + "+thesymbols[2]
}
function getsymbols(){
	thesymbols=new Array()
	for(var j=0;j<theatoms.length;j++){
		thesymbols[j]="<sup>"+theatoms[j][2]+"</sup>"+theatoms[j][0]+"<sub>"+theatoms[j][1]+"</sub>"
	}
}
function answer(form){
	if(tried==1)alert("You've done this one! Get a new problem")
	else{
		if(tried==2){totl++;document.forms[0].total.value=totl}
		if(form.mass0.value==theatoms[1][2] && form.prot0.value==theatoms[1][1]){
			document.forms[0].results.value="Correct"
			corrt++
			document.forms[0].correct.value=corrt
			document.form[0].total.value=totl
		}
		else{
			document.forms[0].results.value="Incorrect"
			tried=2
		}
	}
}
