function matching(qAnswer, UserAns, maxChoice) //maxChoice is a letter
{
  if(UserAns.toLowerCase() >= 'a' && UserAns.toLowerCase() <= maxChoice.toLowerCase())
  {
   jen = open("", "Response", "width=300,height=300");
   jen.document.open();
  
   with(jen.document)
   {
   	write("<html><body onBlur='window.close()'><center>\n");
   	if(UserAns.toLowerCase()==qAnswer)  //if answer is right
     {
     	i++;
    	write("RIGHT!<br>");
    	position = getRand(1);
    	write("<img src='" + Rights[position] + "'>");
    	}
     
     else		//if answer is wrong
     {
    		write("WRONG!<br>");
    		position = getRand(0);
    		write("<img src='" + Wrongs[position] + "'>");
    	}
  		write("</center></body></html>");
   } //end of with
   jen.document.close();
  }
}

function mult(Qnum, Cnum, that)
{
  if(that.checked)
  {
	 	stuff = question[Qnum][Cnum].split("||");
  	if(stuff[1]=="true") i++;
  	jen = open("", "Response", "width=300,height=300");
  	jen.document.open();
  	
  	with (jen.document)
  	{
    	write("<html><body onBlur='window.close()'><center>");
    	write(stuff[2] + "<br>");
  		if(stuff[1]=="true")
  		{
  		 position = getRand(1);
  		 write("<img src='" + Rights[position] + "'>");
  		}
  		else
  		{
  		 position = getRand(0);
  		 write("<img src='" + Wrongs[position] + "'>");
  		}
  		write("</center></body></html>");
  	}
  	jen.document.close();
  }
}

function getRand(RorW) // right or wrong
{
 if(RorW==1) return Math.floor(Math.random() * (RightSize));
 else if(RorW==0) return Math.floor(Math.random() * (WrongSize));
}