﻿<!-- Copyright 2001 William Bontrager
// You may use this JavaScript code so long as the copyright line, the more info link, and 
//      the instructions remain with the code. For additional form creation and script 
//      customizing information, see the article "JavaScript Quiz Program" linked from 
//      http://willmaster.com/possibilities/archives/

NumChoices = 4;

function CalculateScore()
{
	var score = 0;
	var questionCount = 1;
	testname= "Q1";

	while ((document.getElementsByName(testname)).length == NumChoices)
	    {
	        questionCount = questionCount + 1;
		    testname = "Q" + questionCount;
	    }
	    
	for (i = 0; i < NumChoices; i++)
	{
		for (j = 1; j < questionCount; j++)
		{
			var newtest = "Q" + j;
			if(document.getElementsByName(newtest)[i].checked) { score += parseInt(document.getElementsByName(newtest)[i].value); }
		}
	}
	document.aspnetForm.totalscore.value = score;
} 

// � partir d'ici, code pour afficher ou cacher les r�ponses

var isIE=document.all?true:false;
var isDOM=document.getElementById?true:false;
var isNS4=document.layers?true:false;

function montrer(_w) {
	for (i = 1; i < 67; i++)
	{
	_w = "R" + i;
  if (isDOM)
  {
    document.getElementById(_w).style.display='inline'; 
  }
  else if (isIE) {
    eval("document.all."+_w+".style.display='inline';"); 
  }
  else if(isNS4)
  {
    eval("document.layers['"+_w+"'].display='inline';"); 
  }
  }
}
function cacher(_w) {
	for (i = 1; i < 67; i++)
	{
	_w = "R" + i;
  if (isDOM)
  {
    document.getElementById(_w).style.display='none'; 
  }
  else if (isIE) {
    eval("document.all."+_w+".style.display='none';"); 
  }
  else if(isNS4)
  {
    eval("document.layers['"+_w+"'].display='none';"); 
  }
  }
}

// -->
