
ctr=0;

ttl="Spanish Quiz... test your knowledge!";

/* score: */
psco=100;

/* Deduction for each wrong answer. May
   be the perfect score divided by the
   number of questions.  But if you "weight"
   wrong answers, as we have done in this
   little demo script, it may be higher,
   but must be a whole number.  */
wrans=20;

/* Deduction for each "no answer". Usually
   this will be the simple arithmetical
   perfect score divided by number of
   questions. (A whole number) However,
   again, you are in charge. */
noans=20;

/* Change "nr" below to be equal to the
   number of questions you have on this
   test. (Our demo has 5 questions) */
nr=5;

/* Questions */
ques=new Array();
ques[0]="'I don't understand' in Spanish is...";
ques[1]="'How do you say...?' in Spanish is...";
ques[2]="'The red car' in Spanish is...";
ques[3]="'I like chocolate' in Spanish is...";
ques[4]="'I'm Leanne' in Spanish is...";
// add as many questions as you wish here

/* Correct answers... weak!. */
cor="bdcad";

/* Answers */
ans=new Array();

ans[0]="No quiero";
ans[1]="No comprendo";
ans[2]="No se";
ans[3]="A veces";

ans[4]="¿Como se llama...?";
ans[5]="¿Cuanto cuesta...?";
ans[6]="¿Quien es...?";
ans[7]="¿Como se dice...?";

ans[8]="La mesa blanca";
ans[9]="El rojo carro";
ans[10]="El carro rojo";
ans[11]="La casa grande";

ans[12]="Me gusta el chocolate";
ans[13]="Quiero chocolate";
ans[14]="Como mucho chocolate";
ans[15]="No me gusta el chocolate";

ans[16]="Me llamo Leanne";
ans[17]="Me gusta Leanne";
ans[18]="Conozco a Leanne";
ans[19]="Soy Leanne";
// Continue adding answers here



// The rest of the code should not be edited!
ns="0123456789"
ls="abcd";
astr="";
ack=new Array();
for (var i=0;i<nr;i++){
 ack[i]=(nr*4)+1;
 }

function lightIt(){
 document.images[flg+ad].src="nr/rbl.gif";
 }
function dimIt(){
 if (ack[Math.floor(flg/4)]!=flg){
  document.images[flg+ad].src="nr/rbd.gif";
  }
 }
function dumpIt(){
 if (ack[Math.floor(flg/4)]==flg){
  document.images[ack[Math.floor(flg/4)]+ad].src="nr/rbd.gif";
  ack[Math.floor(flg/4)]=(nr*4)+1;
  }
 else{
  if (ack[Math.floor(flg/5)]!=flg&&ack[Math.floor(flg/5)]!=(nr*4)+1){
   document.images[ack[Math.floor(flg/4)]+ad].src="nr/rbd.gif";
   }
  document.images[flg+ad].src="nr/rbl.gif";
  ack[Math.floor(flg/4)]=flg;
  }
 }
function ckSco(){
 document.images[ad+(nr*4)].src="nr/cwf2.gif";
 setTimeout('document.images[ad+(nr*4)].src="nr/cwf0.gif"',1000);

 for (var i=0;i<nr;i++){
  u=cor.charAt(i);
  v=ls.indexOf(u)+(i*4);
  document.images[ad+v].src="nr/gbl.gif";
  }
 sco=psco;
 for (var i=0;i<nr;i++){
  if (ack[i]==(nr*4)+1){
   sco-=noans;
   }
  else{
   u=cor.charAt(i);
   v=ls.indexOf(u)+(i*4);
   sco=(v==ack[i]?sco:sco-wrans);
   }
  }
 sco=(sco<0?0:sco); // prevent minus score
 scos=""+sco;
 while (scos.length<3){
  scos="0"+scos;
  }
 document.images[ad+(nr*4)+1].src="nr/yts.gif";
 ctr=ad+(nr*4)+2;
 for (var i=0;i<3;i++){
  nj=ns.indexOf(scos.charAt(i));
  document.images[ctr].src="nr/"+nj+".gif";
  ctr++;
  }
 }
function litbut(){
 document.images[ad+(nr*4)].src="nr/cwf1.gif";
 }
function dimbut(){
 document.images[ad+(nr*4)].src="nr/cwf0.gif";
 }
 ctr=0;

function srand() {
 today=new Date();
 rand=today.getTime();
 picker=""+rand
 picker=picker.charAt((picker.length - 4));
 rec=eval(picker);
 }
/* This little routine is simply used to count the
   number of images you may place on your web page
   prior to the radio buttons.  Just makes the routine
   independent of how you lay your page out. */
function getImgAdd(){
 for (var i=0;i<20;i++){
  if (document.images[i].src.indexOf("rbd.gif")>-1){
   ad=i;
   i=20;
   }
  }
 } 

