function rating(kai) {	// 得点計算&正解表示:check付ボタンのvalue値を累積する
  var tokuten = 0;
  for (i = 1; i < daisuu + 1; i++) {
    for (j = 0; j < document.forms[i].ans.length; j++) {
      if (document.forms[i].ans[j].checked) {
        tokuten += parseInt(document.forms[i].ans[j].value);
      }
    }
  }
  var res = "<html><head><title>tokuten</title></head>";
  res += "<body bgcolor=white>あなたの得点は";
  res += Math.floor(tokuten*(100/daisuu)+0.5);
  res += "点です。<br>正解は問題1から順に<br>" + kai + "です。<br><center>";
  res += '<input type="button" value="閉じる" onClick="self.close()">';
  res += "</center></body>";
  w = window.open("","resGamen","resizable,height=120,width=230");
  w.document.write(res);
  w.document.close();
}

function unchecked(daisuu) {
  for( i=0; i<daisuu; i++ ) {
    for( j=0; j<document.forms[i].ans.length; j++ ) {
      document.forms[i].ans[j].checked = false;
    }
  }
}
