thepage="Oxidation Numbers(147)"
totl=corrt=answr=theanswer=0
qphrase=new Array(" What is the oxidation number of<b> ","</b> in<b> ","</b> ?")
function startit(){
	clear()
	totl++
	document.forms[0].total.value=totl
	getspecies()
}
function getspecies(){
	choice=Math.floor(Math.random()*cmpd.length)
	thiscmpd=""
	for(j=0;j<cmpd[choice][0];j++){
		if(cmpd[choice][2*j+1]>29 && cmpd[choice][2*j+2]!=1)thiscmpd+="("; 
		thiscmpd+=elements[cmpd[choice][2*j+1]][0] 
		if(cmpd[choice][2*j+1]>29 && cmpd[choice][2*j+2]!=1)thiscmpd+=")"; 
		if(cmpd[choice][2*j+2]!=1)thiscmpd+=("<sub>"+cmpd[choice][2*j+2]+"</sub>");
	}
	if(choice>=250){
		thiscmpd+="<sup>"
		if(Math.abs(cmpd[choice][(cmpd[choice].length-1)])>1)thiscmpd+=(Math.abs(cmpd[choice][(cmpd[choice].length-1)]))
		cmpd[choice][(cmpd[choice].length-1)]<0?thiscmpd+="-</sup>":thiscmpd+="+</sup>";
	}
	if(cmpd[choice][3]==30 || cmpd[choice][3]==31)whichatom=0;
	else whichatom=Math.floor(Math.random()*cmpd[choice][0]);
	thequest=qphrase[0]+elements[cmpd[choice][(2*whichatom+1)]][0]+qphrase[1]+thiscmpd+qphrase[2]
	akey=2*cmpd[choice][0]+whichatom+1
	//cmpd[choice][0]==3?akey=7+whichatom:akey=5+whichatom;
	theanswr=cmpd[choice][akey]
	theanswer=theanswr
	showquest(thequest)
}
function answer(ans){
	if(tried==1)alert("You've done this one. Get a new problem.");
	else{
	attempts++
	if(tried==2){totl++
		document.forms[0].total.value=totl
		}
	if(ans==theanswr ){ 
    		document.forms[0].results.value="correct"
    		corrt++
		document.forms[0].correct.value=corrt
		tried=1
	}
	else {document.forms[0].results.value="incorrect"
	tried=2}
}}
