/* Copyright (C) 1998,2000 by Charles Kelly
This uses (with permission) a couple of functions from:
Short Answer feedback JavaScript by Doug Mills dmills@uiuc.edu
Adapted by Charles Kelly, April 9, 1998 - http://www.aitech.ac.jp/~ckelly
Updated Nov 27, 2000 - Not much like Doug Mills' original script anymore.
This script should not be used elsewhere without permission.
*/

document.bgColor=bgcolor;
YES=new Image;YES.src="../o.gif";
NO=new Image;NO.src="../x.gif";
var sa;
var v=a.length;
p=p.replace(/___/gi,'<INPUT TYPE=text SIZE=8 onBlur=ca()> <IMG SRC=../y.gif height=15 width=15>');
q='<P><center><input type="button" value="Check Answers" onClick="ca()"><P><IMG SRC="../o.gif" height=15 width=15> = Correct <IMG SRC="../x.gif" height=15 width=15> = Incorrect - Try again<P><input type="button" value="Show Correct Answers" onClick="for (i=0;i<v;i++){this.form.elements[i].value=a[i]};ca()"></FORM>';
s='</TD></TR></TABLE></FORM></BODY></HTML>';
z='<CENTER><FORM name=w><TABLE BORDER=4 BORDERCOLOR="#666666" BGCOLOR="#FFFFFF"><TR><TD>'+p+q+s;
function SS(SA){
for(x=0;SA.charAt(x)==" ";x++){}
for(y=SA.length-1;SA.charAt(y)==" ";y--){}
return SA.substring(x,y+1)}
function ca(){
for(var i=0; i<v;i++){if(document.w.elements[i].value!=''){sa=SS(document.w.elements[i].value);document.images[i].src=(sa.toLowerCase()==a[i]) ? YES.src : NO.src}}}
