
var QID = new Array(numQues);
var AID = new Array(numQues);
var pointsperQues = 1;

var aCount = 0;

function hideQList()
{	if (document.all)
		{
		var it = eval("document.all.QADiv" + QID[1] + ".style");
		it.visibility = "visible";
		}
	else if (document.getElementById)
		{
		var it = eval("document.getElementById('QADiv" + QID[1] + "').style");
		it.visibility = "visible";
		
		}
	else  // netscape 4.x
		{
		var it = eval("document.QADiv" + QID[1]);
		it.visibility = "visible";

		}
}



function loadAnArray(theID,theAns)
{
	aCount = aCount + 1;
	QID[aCount] = theID;
	AID[aCount] = theAns;
}	

function gradeQA(y,form)
{
	var theA = getSelectedButton(form);
	var prevSound = 0;
	this.y = y;
	
	if (document.all)
	{
		
		var it = eval("document.all.QADiv" + QID[y] + ".style");
		it.visibility = "hidden";
		
		daAnswer = eval("document.all.the" + theA + "for" + QID[y])
		daAnswer.src = "/f_share_html/virtualexam/images/ckon.gif";
		
		var theRightOne = eval("document.all.correctAns" + QID[y] + ".style");				
		theRightOne.position = "absolute";
		theRightOne.visibility = "visible";

			if (theA == AID[y])
			{
				theScore = theScore + pointsperQues;
				thePic = eval("document.all.image" + QID[y])
				thePic.src = "/f_share_html/virtualexam/images/right.gif"
			}
			else
			{
				thePic = eval("document.all.image" + QID[y])
				thePic.src = "/f_share_html/virtualexam/images/wrong.gif"				
			}
	}
	else if (document.getElementById)
	{
		
		var it = eval("document.getElementById('QADiv" + QID[y] + "').style");
		it.visibility = "hidden";
		
		daAnswer = eval("document.images['the" + theA + "for" + QID[y] + "']")
		daAnswer.src = "/f_share_html/virtualexam/images/ckon.gif";
		
		var theRightOne = eval("document.getElementById('correctAns" + QID[y] + "').style");						
		theRightOne.visibility = "visible";
		theRightOne.position = "absolute";
	
		if (theA == AID[y])
			{
				theScore = theScore + pointsperQues;
				thePic = eval("document.images['image' + QID[y]]")
				thePic.src = "/f_share_html/virtualexam/images/right.gif"	
			}
			else
			{

			thePic = eval("document.images['image' + QID[y]]")
			thePic.src = "/f_share_html/virtualexam/images/wrong.gif"	
		}
	}
	else // netscape 4.x
	{
		var it = eval("document.QADiv" + QID[y]);
		it.visibility = "hidden";
		
		daAnswer = eval("document.correctAns" + theA + ".document.the" + QID[y] + "for" + QID[y])
		daAnswer.src = "/f_share_html/virtualexam/images/ckon.gif";
		
		if (theA == AID[y])
		{
			theScore = theScore + pointsperQues;
			thePic = eval("document.correctAns" + QID[y] + ".document.image" + QID[y])
			thePic.src = "/f_share_html/virtualexam/images/right.gif"

		}
		else
		{
			thePic = eval("document.correctAns" + QID[y] + ".document.image" + QID[y])
			thePic.src = "/f_share_html/virtualexam/images/wrong.gif"
	
		}
		
		var theRightOne = eval("document.correctAns" + QID[y]);
		theRightOne.position = "absolute";
		theRightOne.visibility = "visible";
	}
}

function afterGrade(x)
{	
	//alert("x = " + x + " numQues = " + numQues)
	if (x < numQues)
  	{
		
		if (document.all)
		{
			var theRightOne = eval("document.all.correctAns" + QID[y] + ".style");
			var next = eval("document.all.QADiv" + QID[x+1] + ".style");
			theRightOne.visibility = "hidden";	
		
		}
		else if (document.getElementById)
		{
			var theRightOne = eval("document.getElementById('correctAns' + QID[y]).style");
			var next = eval("document.getElementById('QADiv' + QID[x+1]).style");
			theRightOne.visibility = "hidden";	
		
		}
		else // netscape 4.x
		{
			var theRightOne = eval("document.correctAns" + QID[y]);
			var next = eval("document.QADiv" + QID[x+1]);
			theRightOne.visibility = "hidden";		
		}
		
		next.visibility = "visible";

	}
	else
	{

			document.nextForm.theScore.value = theScore;
			
			document.nextForm.submit();

	}
}

function getSelectedButton(radioGroup)
{	for (var i = 0; i < radioGroup.length; i++)
	{
		if (radioGroup[i].checked)
			{return radioGroup[i].value}
	}
}
