var step = 0
var probNum
var existsWin1 = 0
T = new Array(11)
for(var i=1;i<11;i++){
 T[i] = new Image()
 T[i].src = ""+i+".gif"
}
tested=new Array(1,0,0,0,0,0,0,0,0,0,0)
answer=new Array(11)
answer[1]=new Array("B","R","G")
answer[2]=new Array("G","B","R")
answer[3]=new Array("B","R","G")
answer[4]=new Array("R","B","G")
answer[5]=new Array("B","R","G")
answer[6]=new Array("B","G","R")
answer[7]=new Array("R","B","G")
answer[8]=new Array("G","R","B")
answer[9]=new Array("G","B","R")
answer[10]=new Array("R","G","B")

function checkAns(){
  if (((answer[probNum][0]=="B")&&(document.answers.f0[1].checked))
       ||((answer[probNum][0]=="R")&&(document.answers.f0[0].checked))
       ||((answer[probNum][0]=="G")&&(document.answers.f0[2].checked))){
    if (((answer[probNum][1]=="B")&&(document.answers.f1[1].checked))  
         ||((answer[probNum][1]=="R")&&(document.answers.f1[0].checked))
         ||((answer[probNum][1]=="G")&&(document.answers.f1[2].checked))){
      if (((answer[probNum][2]=="B")&&(document.answers.f2[1].checked))    
           ||((answer[probNum][2]=="R")&&(document.answers.f2[0].checked))
           ||((answer[probNum][2]=="G")&&(document.answers.f2[2].checked))){
               alert("Your answer is correct!")
           }
      else {alert("Your answer is wrong. Try again.")}}
    else {alert("Your answer is wrong. Try again.")}}
  else {alert("Your answer is wrong. Try again.")}
}
function showPicture(){
  closeWin()
  if (step < 10) {
    with(Math){
      probNum=floor(10*random())+1
      if (tested[probNum]) {
        b=1
        while (tested[b]) {b++}
        probNum=b
      }
      tested[probNum]=1
    }
    step++
  }
  if (step==10) {
    document.graphform.nextGraph.value="Done!"
  }
  document.graph.src=T[probNum].src
}
function MM_openBrWindow(theURL,winName,features) { //v1.0
  win1=window.open(theURL,winName,features);
  win1.focus();
  existsWin1=1
}
function closeWin() {
  onerror=null
  if (existsWin1==1) {win1.close()}
}
function showSol() {
  MM_openBrWindow(probNum+'.html','Win','status=yes,scrollbars=yes,resizable=yes,width=450,height=450')
}
