Array.prototype.swap=function(index1,index2){var temp=this[index1];this[index1]=this[index2];this[index2]=temp;};Array.prototype.shuffle=function(){for(var i=0;i0)lbls[i].className='correct';else lbls[i].className='incorrect';if(lbls[i].firstChild.klQA.explanation.length>0){explNode=this.elements.answers.insertBefore(document.createElement('p'),lbls[i].nextSibling);explNode.appendChild(document.createTextNode(lbls[i].firstChild.klQA.explanation));explNode.className='explanation';}}};this.gradeQuestion=function(qstn){qstn.score=0;if(qstn.options & klQuiz.SO_SUM){for(var i=0;i0)this.correctAnswers++;}else{for(var i=0;i0)==(qstn.answers[i].selected))?1:0);}if(qstn.score==qstn.answers.length){this.correctAnswers++;qstn.score=0;var numCA=0;for(var i=0;i0){qstn.score+=qstn.answers[i].value;numCA++;}}qstn.score=qstn.score/numCA;}else{qstn.score=0;}}this.score+=qstn.score;};this.viewResults=function(){this.setStats(this.cfg.quizStatisticsString.gradeQuiz);this.updateStats();this.displayResults();this.mergeFlow();};this.displayResults=function(){this.clearQA();if(this.results instanceof quizResults){this.processPCText(this.results.caption,this.elements.question);var matchScoreI=0;for(var i=1;ithis.results.entries[matchScoreI].score)matchScoreI=i;for(var i=0;i=this.score && this.results.entries[i].score0){this.currentQuestion++;if(this.currentQuestion==this.questions.length){all_right++;if(all_right==2){this.elements.next.firstChild.nodeValue=this.cfg.quizNextAction.toQuizEnd;this.nextAction=this.endQuiz;return;}this.currentQuestion=0;}}var qstn=this.questions[this.questionOrder[this.currentQuestion]];this.displayQuestion(qstn);this.elements.question.className=this.cfg.questionAreaStyles.repeat;this.elements.answers.className=this.cfg.answersAreaStyles.repeat;this.updateStats();this.elements.next.firstChild.nodeValue=this.cfg.quizNextAction.selectAnswer;this.elements.next.disabled=true;this.elements.next.className='disabled';this.nextAction=this.processWrong;};this.processWrong=function(){var qstn=this.questions[this.questionOrder[this.currentQuestion]];var lbls=this.elements.answers.getElementsByTagName('label');for(var i=0,numChecked=0;i