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 above 50% then you have achieved an above average result. <br> Below are the correct solutions to the questions you got wrong"

// These are the solutions
 var Solution = new Array(Total_Question)  
Solution[0] = "No, according to Forbes magazine Oprah Winfrey is the richest celebrity woman. JK Rowling, Madonna and J Lopez are, respectively 2nd, 4th and 9th richest."  
Solution[1] = "From the most recent government produced Annual Survey of Hours and Earnings (ASHE), for the period 1997-2006. In 1997 the gender gap stood at 20.7%, in 2002 it narrowed to 20.1%, it was 17.1% in 2005 and <i>rose</i> slightly to 17.2% in 2006."  
Solution[2] = "No, the answer is Bangladeshi. For more on the position of all ethnic minority women in Britain see the EOC website"
Solution[3] = "According to the BBC Global Factfile 7.5% of the UK population were born abroad"
Solution[4]= "No, the answer is Norway. The analysis is based on the UN's Human Development Index (HDI) is a comparative measure of the life-expectancy, literacy, education and standard of living for countries worldwide"
Solution[5]= "No, the answer is Sierre Leone. The analysis is based on the UN's Human Development Index (HDI) is a comparative measure of the life-expectancy, literacy, education and standard of living for countries worldwide"
Solution[6]= "No, the correct answer is 1 in every 35 people."
Solution[7]= "British Telecom told the BBC in December 2006 that they were about to connect the 10 millionth customer in January 2007"
Solution[8]= "No, the answer is 8 million. Source: http://news.bbc.co.uk/2/hi/in_depth/sci_tech/2003/the_igeneration/default.stm# "
Solution[9]= "No, the correct answer is 1.1 billion and indeed the figure rises to a scandalous 2.4 billion if we include those without access to sanitation."


// 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=450,height=250")
  var MustHave1 = "<HTML><HEAD><TITLE>YOUR SCORE</TITLE></HEAD><BODY><center><font face='Arial' size='4' color='red'><b>SocioQuiz.</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)+".</font></H4>"
            +Solution[number]+"<BR>"
         }
    }
    ReportScore(correct)

}
