var Total_Question = 10         // Remember to change this value
                                // according to # of questions

var msg = "If it reads 80% or above then well done. If it reads between 50% and 79% then you have achieved an above average result. Between 25% and 49% then you need to continue with  your reading. If you received below 25% then....!<br> Below are the correct solutions to the questions you got wrong"

// These are the solutions
 var Solution = new Array(Total_Question)  
Solution[0] = "The correct answer is Ghana"  
Solution[1] = "Du Bois wanted his book to relect the cultural forms of black peoples, hence the inclusion of poems and songs from the experiences of black groups"  
Solution[2] = "Du Bois is famous for his aphorism: 'The problem of the Twentieth Century is the problem of the color line'"
Solution[3] = "The Talented Tenth"
Solution[4]= "Double Consciousness was a key concept throughout all of Du Bois's work"
Solution[5]= "No, the correct answer here is Max Weber. However they never did get together on any collaborative work"
Solution[6]= "No, it was Booker T Washington. Washington suggested blacks should forego their political rights merely accepting industrial training. Du Bois radically disagreed with this."
Solution[7]= "No, after visiting Moscow in 1927 Du Bois read and intergrated into his own works the idea of Marx."
Solution[8]= "No, the answer is class"
Solution[9]= "No, it ws Martin Luther King. Martin Luther was long dead before Du Bois was born! Jesse Jackson probably has said something extremely positive but it wasn't this."


// end of solutions

function GetSelectedButton(ButtonGroup)
{
  for (var x=0; x < ButtonGroup.length; x++)
    if (ButtonGroup[x].checked) return x
  return 0
} 

function ReportScore(correct)
{ 
  var SecWin = 
      window.open("","","scrollbars,width=400,height=250")
  var MustHave1 = "<HTML><HEAD><TITLE>YOUR SCORE</TITLE></HEAD><BODY><center><font face='Arial' size='4' color='red'><b>WEB Du Bois Quiz.</center></font><br><font face='Arial' size='4' color='black'><center><b> How did you do?<br></center><font face='Arial' size='3' color='black'><b> Your result, given in terms of the percentage of questions you answered correctly is:"
  var Percent = "<H2>Score : "+Math.round(correct/Total_Question*100)
                 + "%</H2><HR>"
  msg = MustHave1 +Percent + msg  + "<br><center><INPUT TYPE='BUTTON' VALUE='Close Window' onClick='window.close()'><BR></FORM><br>Tony Fitzgerald</BODY></HTML>"
SecWin.document.write(msg)
  msg = ""  // Clear message
}

function Grade()
{
  var correct = 0
  var wrong = 0
  for (number=0; number < Total_Question; number++)
    {
      var form = document.forms[number]      // Question #
      var i = GetSelectedButton(form.q1)
      if (form.q1[i].value == "1")
         { correct++ } 
        else 
         { wrong++
           msg += "<H4><font color='red'>Question "+(number+1)+".</H4>"
            +Solution[number]+"<BR>"
         }
    }
    ReportScore(correct)

}

