function mccheck(i)
{ ans=0;
  correctA=parseInt(eval('document.question_'+i+'.correctA.value'),10);
  if (eval('document.question_'+i+'.mcq['+(correctA-1)+'].checked')==true)
     ans=1;
  scoring (i, ans);
  score=eval('document.question_'+i+'.score.value');
  yourscore+=parseInt(eval('document.question_'+i+'.score.value'),10);
  maxscore+=parseInt(eval('document.question_'+i+'.vscore1.value'),10);
  attempt=eval('document.question_'+i+'.attempt.value');
  evaluation+='<tr nowrap="nowrap" align="center" bgcolor="#BADCDC">';
  evaluation+='<td>'+i+'</td>';
  evaluation+='<td>-</td>';
  evaluation+='<td>-</td>';
  evaluation+='<td>'+score+'</td>';
  evaluation+='<td>'+eval('document.question_'+i+'.vscore1.value')+'</td>';
  evaluation+='<td>'+attempt+'</td>';
  evaluation+='<form><td><input class="button" type="button" name="feedback" value=" Feedback " onclick="opener.givefeedback('+i+')"></td></form></tr>';}

function lmccheck(i)
{ ans=parseInt(eval('document.question_'+i+'.correctA.value'),10)-1;
  eval('document.question_'+i+'.mcq['+ans+'].checked=true');}

function scoring_system_mcq(q)
{ comment='<table class="feedback"><tr><td><I>Scoring: '+eval('document.question_'+q+'.vscore1.value');
  if (eval('document.question_'+q+'.vscore1.value') > 1)
     comment+=' marks for first correct attempt. ';
  else
     comment+=' mark for first correct attempt.';
  if (eval('document.question_'+q+'.vscore2.value') != 0 && eval('document.question_'+q+'.vscore2.value') != "")
  {  comment+=''+eval('document.question_'+q+'.vscore2.value');
     if (eval('document.question_'+q+'.vscore2.value') > 1)
        comment+=' marks for second attempt.';
     else
        comment+=' mark for second attempt.';}
  comment+=' Otherwise no score.<br/><br/>';
  comment+='Your Score:</I> <input class="info" type="text" name="f_score" size=3 value="" onChange="checkScore(this.form)">&nbsp;&nbsp;&nbsp;';
  comment+='<input class="button" type="button" name="b_feedback" value=" Feedback " onclick="check_givefeedback('+q+')"></td></tr></table>';
  document.writeln(comment);}

function boxcheck (i)
{ ans=0; nb_correct=0; nb_incorrect=0;
  nb_choices=eval('document.question_'+i+'.box.length');
  for (j=0 ; j<nb_choices ; j++)
  {  if (eval('document.question_'+i+'.box['+j+'].checked')==true && eval('document.question_'+i+'.box['+j+'].value')==0)
        nb_incorrect++;
     else if (eval('document.question_'+i+'.box['+j+'].checked')==true && eval('document.question_'+i+'.box['+j+'].value')==1)
        nb_correct++;
     else if (eval('document.question_'+i+'.box['+j+'].checked')==false && eval('document.question_'+i+'.box['+j+'].value')==0)
        nb_correct++;
     else if (eval('document.question_'+i+'.box['+j+'].checked')==false && eval('document.question_'+i+'.box['+j+'].value')==1)
        nb_incorrect++;}
  if (nb_incorrect==0)
     ans=1;
  scoring (i, ans);
  score=eval('document.question_'+i+'.score.value');
  yourscore+=parseInt(score,10);
  maxscore+=parseInt(eval('document.question_'+i+'.vscore1.value'),10);
  attempt=eval('document.question_'+i+'.attempt.value');
  evaluation+='<tr nowrap="nowrap" align="center" bgcolor="#BADCDC">';
  evaluation+='<td>'+i+'</td>';
  evaluation+='<td>'+nb_correct+'</td>';
  evaluation+='<td>'+nb_incorrect+'</td>';
  evaluation+='<td>'+score+'</td>';
  evaluation+='<td>'+eval('document.question_'+i+'.vscore1.value')+'</td>';
  evaluation+='<td>'+attempt+'</td>';
  evaluation+='<form><td><input class="button" type="button" name="feedback" value=" Feedback " onclick="opener.givefeedback('+i+')"></td></form></tr>';}

function lboxcheck(i)
{ nb_choices=eval('document.question_'+i+'.box.length');
  for (j=0 ; j<nb_choices ; j++)
     eval('document.question_'+i+'.box['+j+'].checked=false');
  for (j=0 ; j<nb_choices ; j++)
     if (eval('document.question_'+i+'.box['+j+'].value')==1)
        eval('document.question_'+i+'.box['+j+'].checked=true');}

function scoring_system_mrq(q)
{ comment='<table class="feedback"><tr><td><I>Score: '+eval('document.question_'+q+'.vscore1.value');
  if (eval('document.question_'+q+'.vscore1.value') > 1)
     comment+=' marks for first attempt.';
  else
     comment+=' mark for first attempt.';
  if (eval('document.question_'+q+'.vscore2.value') != 0 && eval('document.question_'+q+'.vscore2.value') != "")
  {  comment+=' '+eval('document.question_'+q+'.vscore2.value');
     if (eval('document.question_'+q+'.vscore2.value') > 1)
        comment+=' marks for second attempt.';
     else
        comment+=' mark for second attempt.';}
  comment+=' Otherwise no score.<br/><br/>';
  comment+='Your Score:</I> <input class="info" type="text" name="f_score" size="3" value="" onChange="checkScore(this.form)">&nbsp;&nbsp;&nbsp;';
  comment+='<input class="button" type="button" name="b_feedback" value=" Feedback " onclick="check_givefeedback('+q+')"></td></tr></table>';
  document.writeln(comment);}

function orderedList (i)
{ ans=0; nb_correct=0; nb_incorrect=0;
  nb_choices=eval('document.question_'+i+'.idx.length');
  for (j=0 ; j<nb_choices ; j++)
     if (eval('document.question_'+i+'.list['+j+'].selectedIndex==document.question_'+i+'.idx['+j+'].value'))
        nb_correct++;
     else
        nb_incorrect++;
  if (nb_incorrect==0)
     ans=1;
  scoring (i, ans);
  score=eval('document.question_'+i+'.score.value');
  yourscore+=parseInt(score,10);
  maxscore+=parseInt(eval('document.question_'+i+'.vscore1.value'),10);
  attempt=eval('document.question_'+i+'.attempt.value');
  evaluation+='<tr nowrap="nowrap" align="center" bgcolor="#BADCDC">';
  evaluation+='<td>'+i+'</td>';
  evaluation+='<td>'+nb_correct+'</td>';
  evaluation+='<td>'+nb_incorrect+'</td>';
  evaluation+='<td>'+score+'</td>';
  evaluation+='<td>'+eval('document.question_'+i+'.vscore1.value')+'</td>';
  evaluation+='<td>'+attempt+'</td>';
  evaluation+='<form><td><input class="button" type="button" name="feedback" value=" Feedback " onclick="opener.givefeedback('+i+')"></td></form></tr>';}

function showOrderedList (i)
{ form=eval('document.question_'+i);
  lg=form.list.length;
  for (j=0 ; j<lg ; j++)
     form.list[j].selectedIndex=form.idx[j].value;}

function scoring_system_olq(q)
{ comment='<table class="feedback"><tr><td><I>Score: '+eval('document.question_'+q+'.vscore1.value');
  if (eval('document.question_'+q+'.vscore1.value') > 1)
     comment+=' marks for first attempt.';
  else
     comment+=' mark for first attempt.';
  if (eval('document.question_'+q+'.vscore2.value') != 0 && eval('document.question_'+q+'.vscore2.value') != "")
  {  comment+=' '+eval('document.question_'+q+'.vscore2.value');
     if (eval('document.question_'+q+'.vscore2.value') > 1)
        comment+=' marks for second attempt.';
     else
        comment+=' mark for second attempt.';}
  comment+=' Otherwise no score.<br/><br/>';
  comment+='Your Score:</I> <input class="info" type="text" name="f_score" size="3" value="" onChange="checkScore(this.form)">&nbsp;&nbsp;&nbsp;';
  comment+='<input class="button" type="button" name="b_feedback" value=" Feedback " onclick="check_givefeedback('+q+')"></td></tr></table>';
  document.writeln(comment);}

function isequal (answer,pattern)
{ return (answer==pattern);}

function isin (answer,pattern)
{ answer=answer.toUpperCase();
  pattern=pattern.toUpperCase();
  result=answer.indexOf(pattern);
  if (result<0)
     return(false);
  else
     return(true);}

function shortcheck (i)
{ ans=0;
  answer=eval('document.question_'+i+'.answer.value');
  correct1=eval('document.question_'+i+'.correct1.value');
  correct2=eval('document.question_'+i+'.correct2.value');
  correct3=eval('document.question_'+i+'.correct3.value');
  if (eval('document.question_'+i+'.compare.value')=="=")
  { if ((isequal (answer,correct1) || isequal (answer,correct2) || isequal(answer,correct3)) && answer !="")
        ans=1;}
  else
  { if (((isin (answer,correct1) && correct1 != "") || (isin (answer,correct2) && correct2 != "") || (isin (answer,correct3) && correct3 != "" )) && answer !="")
      ans=1;}
  scoring (i,ans);
  score=eval('document.question_'+i+'.score.value');
  yourscore+=parseInt(eval('document.question_'+i+'.score.value'),10);
  maxscore+=parseInt(eval('document.question_'+i+'.vscore1.value'),10);
  attempt=eval('document.question_'+i+'.attempt.value');
  evaluation+='<tr nowrap="nowrap" align="center" bgcolor="#BADCDC">';
  evaluation+='<td>'+i+'</td>';
  evaluation+='<td>-</td>';
  evaluation+='<td>-</td>';
  evaluation+='<td>'+score+'</td>';
  evaluation+='<td>'+eval('document.question_'+i+'.vscore1.value')+'</td>';
  evaluation+='<td>'+attempt+'</td>';
  evaluation+='<form><td><input class="button" type="button" name="feedback" value=" Feedback " onclick="opener.givefeedback('+i+')"></td></form></tr>';}

function lshortcheck(i)
{ eval('document.question_'+i+'.answer.value=document.question_'+i+'.correct1.value');}

function scoring_system_wmq(q)
{ comment='<table class="feedback"><tr><td><I>Score: '+eval('document.question_'+q+'.vscore1.value');
  if (eval('document.question_'+q+'.vscore1.value') > 1)
     comment+=' marks for first attempt.';
  else
     comment+=' mark for first attempt.';
  if (eval('document.question_'+q+'.vscore2.value') != 0 && eval('document.question_'+q+'.vscore2.value') != "")
  {  comment+=' '+eval('document.question_'+q+'.vscore2.value');
     if (eval('document.question_'+q+'.vscore2.value') > 1)
        comment+=' marks for second attempt.';
     else
        comment+=' mark for second attempt.';}
  comment+=' Otherwise no score.<br/><br/>';
  comment+='Your Score:</I> <input class="info" type="text" name="f_score" size="3" value="" onChange="checkScore(this.form)">&nbsp;&nbsp;&nbsp;';
  comment+='<input class="button" type="button" name="b_feedback" value=" Feedback " onclick="check_givefeedback('+q+')"></td></tr></table>';
  document.writeln(comment);}

function fill_build_text (form)
{ formattedText="";
  gapList="";
  gapIndex=0;
  parsecharacter=" ";
  temp="";
  see=form.seeWords.value;
  srcTxt=form.srcTxt.value;
  if (srcTxt.length > 55)
  { errormessage("Your text contains more than 55 characters.");
     return;}
  for (i=0 ; i<srcTxt.length ; i++)
  { c=srcTxt.charAt(i);
     if (c!=" " && c!="!" && c!='"' && c!="-" && c!="(" && c!=")" && c!=":" && c!=";" && c!="," && c!="." && c!="?")
        temp+=c;
     else
     {  if (c == " ")
        {  if (temp != "")
           {  formattedText+='<input class="info" type="text" name=ans' + gapIndex++ + ' size=' + temp.length + ' value="">&nbsp;';
              gapList+=temp+" - ";
              temp="";}}
        else
        {if (temp != "")
           { formattedText+='<input class="info" type="text" name=ans' + gapIndex++ + ' size=' + temp.length + ' value="">&nbsp;';
              gapList+=temp+" - ";
              temp="";}
           formattedText+=c;}}}
  if (gapList!="")
  {  parsecharacter = "-";
     keyword = new Array(gapIndex);
     y=0;
     while(gapList.indexOf(parsecharacter) > 0)
     {  pos=gapList.indexOf(parsecharacter);
        keyword[y]=gapList.substring(0,pos);
        keyword[y]=stripInput(keyword[y]);
        y++;
        gapList=gapList.substring(pos+1,gapList.length);}
     form.keyword.value=keyword;
     form.gapIndex.value=gapIndex;
     newKeyword=randomizer(gapIndex, keyword);
     gapList="<table class='exchange'><tr><td><i>";
     for ( i=0 ; i<gapIndex ; i++ )
        gapList+=newKeyword[i]+" - ";
     gapList=gapList.substring(0,gapList.lastIndexOf("-"));
     gapList+="</i></td></tr></table><p></p>";
     if (see=="on" && gapList!="")
        document.writeln(gapList);}
  document.writeln(formattedText);}

function order_check (i)
{ ans=0; nb_correct=0; nb_incorrect=0;
  newKeyword=init_fill_order(i);
  maxWd=eval('document.question_'+i+'.gapIndex.value');
  for (j=0 ; j<maxWd ; j++)
  {  temp=stripInput(eval('document.question_'+i+'.ans'+j+'.value'));
     eval('document.question_'+i+'.ans'+j+'.value=temp');
     if (newKeyword[j].toLowerCase()==temp.toLowerCase() && temp!="")
        nb_correct++;
     else
        nb_incorrect++;}
  if (nb_incorrect==0)
     ans=1;
  scoring_order (i, ans);
  score=eval('document.question_'+i+'.score.value');
  yourscore+=parseInt(score,10);
  maxscore+=parseInt(eval('document.question_'+i+'.vscore1.value'),10);
  attempt=eval('document.question_'+i+'.attempt.value');
  evaluation+='<tr nowrap="nowrap" align="center" bgcolor="#BADCDC">';
  evaluation+='<td>'+i+'</td>';
  evaluation+='<td>'+nb_correct+'</td>';
  evaluation+='<td>'+nb_incorrect+'</td>';
  evaluation+='<td>'+score+'</td>';
  evaluation+='<td>'+eval('document.question_'+i+'.vscore1.value')+'</td>';
  evaluation+='<td>'+attempt+'</td>';
  evaluation+='<form><td><input type="button" name="feedback" value=" Feedback " onclick="opener.givefeedback('+i+')"></td></form></tr>';}

function init_fill_order (q)
{ keyword=eval('document.question_'+q+'.keyword.value')+",";
  parsecharacter=",";
  newKeyword=new Array(eval('document.question_'+q+'.gapIndex.value'));
  y=0;
  while(keyword.indexOf(parsecharacter) > 0)
  {  pos=keyword.indexOf(parsecharacter);
     newKeyword[y]=keyword.substring(0,pos);
     newKeyword[y]=stripInput(newKeyword[y]);
     y++;
     keyword=keyword.substring(pos+1,keyword.length);}
  return(newKeyword);}

function order_reveal (i)
{ newKeyword=init_fill_order(i);
  max=eval('document.question_'+i+'.gapIndex.value');
  for (j=0 ; j<max ; j++ )
     eval('document.question_'+i+'.ans'+j+'.value=newKeyword['+j+']');}

function scoring_system_order(q)
{ comment='<table class="feedback"><tr><td><I>Score: '+eval('document.question_'+q+'.vscore1.value');
  if (eval('document.question_'+q+'.vscore1.value') > 1)
     comment+=' marks for three attempts or less.';
  else
     comment+=' mark for three attempts or less.';
  if (eval('document.question_'+q+'.vscore2.value') != 0 && eval('document.question_'+q+'.vscore2.value') != "")
  {  comment+=' '+eval('document.question_'+q+'.vscore2.value');
     if (eval('document.question_'+q+'.vscore2.value') > 1)
        comment+=' marks for 4-6 attempts to correctly order the phrase.';
     else
        comment+=' mark for4-6 attempts to correctly order the phrase.';}
  comment+=' Otherwise no score.<br/><br/>';
  comment+='Your Score:</I> <input type="text" name="f_score" size="3" value="" onChange="checkScore(this.form)">&nbsp;&nbsp;&nbsp;';
  comment+='<input type="button" name="b_feedback" value=" Feedback " onclick="check_givefeedback('+q+')"></td></tr></table>';
  document.writeln(comment);}

function scoring_order (i, ans)
{ form=eval('document.question_'+i);
  if (form.attempt.value<"3" && ans=="1")
     form.score.value=form.vscore1.value;
  else
  {  if (form.attempt.value<"6" && ans=="1" && form.score.value=="0")
        form.score.value=form.vscore2.value;
     else if (ans=="0")
        form.score.value="0";}
  form.f_score.value=form.score.value;
  if (form.found.value=="0" && ans==1)
  {  form.found.value="1";
     ++form.attempt.value;}
  else if (form.found.value=="0")
     ++form.attempt.value;
  form.work.value="true";}

function fill_init_text (form)
{ formattedText="";
  gapList="";
  gapIndex=0;
  parsecharacter="@";
  srcTxt=form.srcTxt.value;
  see=form.seeWords.value;
  while(srcTxt.indexOf(parsecharacter) > 0 || srcTxt.length != 0)
  {  pos=srcTxt.indexOf(parsecharacter);
     if (pos > 0)
     {  formattedText+=srcTxt.substring(0,pos);
        srcTxt=srcTxt.substring(pos+1,srcTxt.length);
        pos=srcTxt.indexOf(parsecharacter);
        if (pos > 0)
        {  temp=srcTxt.substring(0,pos);
           gapList+=temp+" - ";
           formattedText+='<input type="text" name=ans' + gapIndex++ + ' size=' + temp.length + ' value="">';
           srcTxt=srcTxt.substring(pos+1,srcTxt.length);}
        else
        {  gapList+=srcTxt+" - ";
           formattedText+='<input type="text" name=ans' + gapIndex++ + ' size=' + srcTxt.length + ' value="">';
           srcTxt="";}}
     else
     {  formattedText+=srcTxt;
        srcTxt="";}}
  if (gapList!="")
  {  parsecharacter = "-";
     keyword = new Array(gapIndex);
     y=0;
     while(gapList.indexOf(parsecharacter) > 0)
     {  pos=gapList.indexOf(parsecharacter);
        keyword[y]=gapList.substring(0,pos);
        keyword[y]=stripInput(keyword[y]);
        y++;
        gapList=gapList.substring(pos+1,gapList.length);}
     form.keyword.value=keyword;
     form.gapIndex.value=gapIndex;
     newKeyword=randomizer(gapIndex, keyword);
     gapList="<table class='note'><tr><td>";
     for ( i=0 ; i<gapIndex ; i++ )
        gapList+=newKeyword[i]+" - ";
     gapList=gapList.substring(0,gapList.lastIndexOf("-"));
     gapList+="</td></tr></table>";
     if (see=="on")
        document.writeln(gapList+"<br/>");}
  document.writeln("<p class='response'>"+formattedText+"</p>");}

function fill_check (i)
{ ans=0; nb_correct=0; nb_incorrect=0;
  newKeyword=fill_init(i);
  maxWd=eval('document.question_'+i+'.gapIndex.value');
  for ( j=0 ; j<maxWd ; j++ )
     if (newKeyword[j].toLowerCase()==eval('document.question_'+i+'.ans'+j+'.value.toLowerCase()'))
        nb_correct++;
     else
        nb_incorrect++;
  if (nb_incorrect==0)
     ans=1;
  scoring (i, ans);
  score=eval('document.question_'+i+'.score.value');
  yourscore+=parseInt(score,10);
  maxscore+=parseInt(eval('document.question_'+i+'.vscore1.value'),10);
  attempt=eval('document.question_'+i+'.attempt.value');
  evaluation+='<tr nowrap="nowrap" align="center" bgcolor="#BADCDC">';
  evaluation+='<td>'+i+'</td>';
  evaluation+='<td>'+nb_correct+'</td>';
  evaluation+='<td>'+nb_incorrect+'</td>';
  evaluation+='<td>'+score+'</td>';
  evaluation+='<td>'+eval('document.question_'+i+'.vscore1.value')+'</td>';
  evaluation+='<td>'+attempt+'</td>';
  evaluation+='<form><td><input class="button" type="button" name="feedback" value=" Feedback " onclick="opener.givefeedback('+i+')"></td></form></tr>';}  

function fill_init (q)
{ keyword=eval('document.question_'+q+'.keyword.value')+",";
  parsecharacter=",";
  newKeyword=new Array(eval('document.question_'+q+'.gapIndex.value'));
  y=0;
  while(keyword.indexOf(parsecharacter) > 0)
  {  pos=keyword.indexOf(parsecharacter);
     newKeyword[y]=keyword.substring(0,pos);
     newKeyword[y]=stripInput(newKeyword[y]);
     y++;
     keyword=keyword.substring(pos+1,keyword.length);}
  return(newKeyword);}

function fill_reveal (i)
{ newKeyword=fill_init(i);
  max=eval('document.question_'+i+'.gapIndex.value');
  for (j=0 ; j<max ; j++ )
     eval('document.question_'+i+'.ans'+j+'.value=newKeyword['+j+']');}

function scoring_system_fillq(q)
{ comment='<table class="feedback"><tr><td><I>Score '+eval('document.question_'+q+'.vscore1.value');
  if (eval('document.question_'+q+'.vscore1.value') > 1)
     comment+=' marks for first attempt.';
  else
     comment+=' mark for first attempt.';
  if (eval('document.question_'+q+'.vscore2.value') != 0 && eval('document.question_'+q+'.vscore2.value') != "")
  {  comment+=' '+eval('document.question_'+q+'.vscore2.value');
     if (eval('document.question_'+q+'.vscore2.value') > 1)
        comment+=' marks for second attempt.';
     else
        comment+=' mark for second attempt.';}
  comment+=' Otherwise no score.<br/><br/>';
  comment+='Your Score:</I> <input class="info" type="text" name="f_score" size="3" value="" onChange="checkScore(this.form)">&nbsp;&nbsp;&nbsp;';
  comment+='<input class="button" type="button" name="b_feedback" value=" Feedback " onclick="check_givefeedback('+q+')"></td></tr></table>';

  document.writeln(comment);}

function imccheck(i)
{ ans=0;
  correctA=parseInt(eval('document.question_'+i+'.correctA.value'),10);
  if (eval('document.question_'+i+'.mcq['+(correctA-1)+'].checked')==true)
     ans=1;
  scoring (i, ans);
  score=eval('document.question_'+i+'.score.value');
  yourscore+=parseInt(eval('document.question_'+i+'.score.value'),10);
  maxscore+=parseInt(eval('document.question_'+i+'.vscore1.value'),10);
  if (eval('document.question_'+i+'.attempt.value==0'))
     attempt="-";
  else
     attempt=eval('document.question_'+i+'.attempt.value');
  evaluation+='<tr nowrap="nowrap" align="center" bgcolor="#BADCDC">';
  evaluation+='<td>'+i+'</td>';
  evaluation+='<td>-</td>';
  evaluation+='<td>-</td>';
  evaluation+='<td>'+score+'</td>';
  evaluation+='<td>'+eval('document.question_'+i+'.vscore1.value')+'</td>';
  evaluation+='<td>'+attempt+'</td>';
  evaluation+='<form><td><input type="button" name="feedback" value=" Feedback " onclick="opener.givefeedback('+i+')"></td></form></tr>';}

function ilmccheck(i)
{ ans=parseInt(eval('document.question_'+i+'.correctA.value'),10)-1;
  eval('document.question_'+i+'.mcq['+ans+'].checked=true');}

function scoring_system_imcq(q)
{ comment='<table class="feedback"><tr><td><I>Score '+eval('document.question_'+q+'.vscore1.value');
  if (eval('document.question_'+q+'.vscore1.value') > 1)
     comment+=' marks for first attempt.';
  else
     comment+=' mark for first attempt.';
  if (eval('document.question_'+q+'.vscore2.value') != 0 && eval('document.question_'+q+'.vscore2.value') != "")
  {  comment+=' '+eval('document.question_'+q+'.vscore2.value');
     if (eval('document.question_'+q+'.vscore2.value') > 1)
        comment+=' marks for second attempt.';
     else
        comment+=' mark for second attempt.';}
  comment+=' Otherwise no score.<br/><br/>';
  comment+='Your Score:</I> <input clas="info" type="text" name="f_score" size="3" value="" onChange="checkScore(this.form)">&nbsp;&nbsp;&nbsp;';
  comment+='<input class="button" type="button" name="b_feedback" value=" Feedback " onclick="check_givefeedback('+q+')"></td></tr></table>';
  document.writeln(comment);}

function iboxcheck (i)
{ ans=0; nb_correct=0; nb_incorrect=0;
  nb_choices=eval('document.question_'+i+'.box.length');
  for (j=0 ; j<nb_choices ; j++)
  {  if (eval('document.question_'+i+'.box['+j+'].checked')==true && eval('document.question_'+i+'.box['+j+'].value')==0)
        nb_incorrect++;
     else if (eval('document.question_'+i+'.box['+j+'].checked')==true && eval('document.question_'+i+'.box['+j+'].value')==1)
        nb_correct++;
     else if (eval('document.question_'+i+'.box['+j+'].checked')==false && eval('document.question_'+i+'.box['+j+'].value')==0)
        nb_correct++;
     else if (eval('document.question_'+i+'.box['+j+'].checked')==false && eval('document.question_'+i+'.box['+j+'].value')==1)
        nb_incorrect++;}
  if (nb_incorrect==0)
     ans=1;
  scoring (i, ans);
  score=eval('document.question_'+i+'.score.value');
  yourscore+=parseInt(score,10);
  maxscore+=parseInt(eval('document.question_'+i+'.vscore1.value'),10);
  attempt=eval('document.question_'+i+'.attempt.value');
  evaluation+='<tr nowrap="nowrap" align="center" bgcolor="#BADCDC">';
  evaluation+='<td>'+i+'</td>';
  evaluation+='<td>'+nb_correct+'</td>';
  evaluation+='<td>'+nb_incorrect+'</td>';
  evaluation+='<td>'+score+'</td>';
  evaluation+='<td>'+eval('document.question_'+i+'.vscore1.value')+'</td>';
  evaluation+='<td>'+attempt+'</td>';
  evaluation+='<form><td><input class="button" type="button" name="feedback" value=" Feedback " onclick="opener.givefeedback('+i+')"></td></form></tr>';}

function ilboxcheck(i)
{ nb_choices=eval('document.question_'+i+'.box.length');
  for (j=0 ; j<nb_choices ; j++)
     eval('document.question_'+i+'.box['+j+'].checked=false');
  for (j=0 ; j<nb_choices ; j++)
     if (eval('document.question_'+i+'.box['+j+'].value')==1)
        eval('document.question_'+i+'.box['+j+'].checked=true');}

function scoring_system_imrq(q)
{ comment='<table class="feedback"><tr><td><I>Score '+eval('document.question_'+q+'.vscore1.value');
  if (eval('document.question_'+q+'.vscore1.value') > 1)
     comment+=' marks for first attempt.';
  else
     comment+=' mark for first attempt.';
  if (eval('document.question_'+q+'.vscore2.value') != 0 && eval('document.question_'+q+'.vscore2.value') != "")
  {  comment+=' '+eval('document.question_'+q+'.vscore2.value');
     if (eval('document.question_'+q+'.vscore2.value') > 1)
        comment+=' marks for second attempt.';
     else
        comment+=' mark for second attempt.';}
  comment+=' Otherwise no score.<br/><br/>';
  comment+='Your Score:</I> <input class="info" type="text" name="f_score" size="3" value="" onChange="checkScore(this.form)">&nbsp;&nbsp;&nbsp;';
  comment+='<input class="button" type="button" name="b_feedback" value=" Feedback " onclick="check_givefeedback('+q+')"></td></tr></table>';
  document.writeln(comment);}