//----------------------------------------------												 
//Remediation.js (used as grading include to pop quiz's)
//Keep the following global code in root directory	
// continue and tryagain gifs go in same directory as this remediation.js											   
//declare variables

var msg = "";
var btnsrc="";
var formAction="";
var correct = "";					 
var wrong = "";
// var thisLocation = wrongLocation;

function GetSelectedButton(ButtonGroup)
{
  for (var x=0; x < ButtonGroup.length; x++)
    if (ButtonGroup[x].checked) return x
  return -1
} 

function ReportScore(location)
{ 
    remWin = window.open("","","scrollbars,width=300,height=200");
	remWin.focus();
	remWin.document.write(' <html><title>Remediation</title><body bgcolor="white">');
	remWin.document.write(' <font face="Arial" size="2">' +msg+ '</font>');
	remWin.document.write('<br><br><p align="center"><form action="'+location+'" target="main" onSubmit="submit(); window.close();" ><input type="button" value="'+ btnsrc +'" onclick="opener.document.location=\''+location+'\'; window.close();"></p></form></body></html>');
	remWin.document.close();
}

function Grade() 
{
//	 window.name = "parentWindow";
	 var report = 0				   
	 var remLocation = "";						  
     var form = document.forms[0];      
     var i = GetSelectedButton(form.q1);

    if (i >= 0 && form.q1[i].value.toUpperCase() == correctAnswer.toUpperCase()){ 
  	  var correct = form.q1[i].value.toUpperCase();
      msg = eval("message"+correct);
	  btnsrc = "Continue ...";	
	  thisLocation = correctLocation;						   
  	 } else if (i == -1) { //-1 equals null
	  msg = "Please select an answer";
	  btnsrc = "Try Again";
	  thisLocation =  wrongLocation;	
	} else { 
	  var wrong = form.q1[i].value.toUpperCase();
      msg = eval("message"+wrong);
	  btnsrc = "Try Again ";
	  thisLocation =  wrongLocation;					   
     }
	ReportScore(thisLocation);
} 
//-------------------------------------------------------------



