thepage="Mole relations-rxns(132)"
//updated 12/02/02-netscape 7
refnumber=177
totl=0
corrt=0
tried=0
attempts=0
first=0
second=0
theanswr=0
theanswer=""
qphrase=new Array()
seq=new Array()
introphrase="For the balanced equation shown below, how many moles of "
qphrase[0]=new Array(" will react with "," moles of ","?")
qphrase[1]=new Array(" be produced by "," moles of ","?")
qphrase[2]=new Array(" reacted, if "," moles of "," are produced?")
qphrase[3]=new Array(" will be produced, if "," moles of "," are produced?")
ansphrase=new Array("To answer this question, you use the stiochiometric ratio between "," and ","<br>Rearranging the equation and solving for "," yields:<br> ")
function startit(){
	clear()
	totl++
	document.forms[0].total.value=totl
	document.forms[0].results.value=""
	choose()
	buildquestion()
}
function buildquestion(){
	first=Math.floor(coeffs[choice].length*Math.random())
	second=first
	while(second==first)second=Math.floor(coeffs[choice].length*Math.random())
	if(first<=split)second<=split?option=0:option=1;
	else second<=split?option=2:option=3;
	moles=new Array()
	moles[0]=number(Math.random(),4,3)
	moles[1]=moles[0]*coeffs[choice][second]/coeffs[choice][first]
	moles[1]=theanswr=number(moles[1],4,3)
	thewhole=new Array(moles[0],moles[1],formula[first],formula[second])
	thequest=introphrase+thewhole[3]+qphrase[option][0]+thewhole[0]+qphrase[option][1]+thewhole[2]+qphrase[option][2]+"<br>"+equation
	buildanswer(thewhole)
	theanswr=thewhole[1]
	showquest(thequest)
}
function buildanswer(thewhole){
	eqn1=thewhole[3]+"/"+thewhole[2]+"="+coeffs[choice][second]+"/"+coeffs[choice][first]+"=?/"+thewhole[0]
	eqn2=coeffs[choice][second]+"/"+coeffs[choice][first]+"*"+thewhole[0]+"="+thewhole[1]
	theanswer=ansphrase[0]+thewhole[3]+ansphrase[1]+thewhole[2]+"<br>"+eqn1+"<br>"+ansphrase[2]+thewhole[3]+ansphrase[3]+eqn2
	//showanswer(theanswer)
}	

function answer(ans){
	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(ans>.95*theanswr & ans<1.05*theanswr){
		tried=1
		document.forms[0].results.value="Correct"
		corrt++
		document.forms[0].correct.value=corrt
	}
	else{
		tried=2
		document.forms[0].results.value="Incorrect"
	}}
}
