'; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += '
'; ReadingText='


3 minutes to do it...
'; if (is.CRAPBrowser){ReadingText=ResolveAllURLs(ReadingText);} var NavBar=''; NavBar+='
'; NavBar+=''; NavBar+=''; NavBar+=''; NavBar+='
'; if (is.CRAPBrowser){NavBar=ResolveAllURLs(NavBar)}; var TitleCode = ''; TitleCode += '' + ExerciseTitle + '
'; TitleCode += '' + ExerciseSubtitle + '
'; TitleCode += '
'; var QButtonsOpener = ''; QButtonsOpener += '
'; QButtonsOpener += ''; var QButtonsCloser = ''; QButtonsCloser += '
'; var TableOpener = '
'; TableOpener += ''; var QRow = ''; QRow += ''; var ARow = ''; ARow += ''; ARow += ''; var MARow = ''; var CheckButton = ''; } Output = Output + BuildQuestion(I.length-1); Output = TableOpener + Output + TableCloser; DisplayExercise(Output); } function ShowQuestion(QNum){ //First, create the Q number readout at the top var Readout = (QNum+1) + '/' + I.length; while (Readout.length < 7){ Readout = ' ' + Readout + ' '; } Readout = QButtonsOpener + Readout + QButtonsCloser; var Output = BuildQuestion(QNum); Output = TableOpener + Output + TableCloser; DisplayExercise(Readout + Output); //Mark the answers already done for (i=0; i=0; i--){ //Find any incorrect choices var b = eval('BottomFrame.document.QForm.A_' + QNum + '_' + i); if (b != null){ //if it's wrong, count it if (b.checked == true){ Status[QNum][1][i] = 'C'; } else{ Status[QNum][1][i] = 'U'; } if (((b.checked == true) && (b.value == "0"))||((b.checked == false)&&(b.value == "1"))){ TotWrong++; } } } if (TotWrong == 0){ Output = DefaultRight; } else{ Output = DefaultWrong + '
' + (TotAns-TotWrong) + '/' + TotAns; } //If you haven't tried the question before if (Status[QNum][0] == 0){ if (TotWrong > 0){ Status[QNum][2]++; } if (TotWrong == 0){ Status[QNum][0] = 1; //Calculate the score for this question as a floating-point fraction of 1 Status[QNum][3] = ((Status[QNum][1].length - Status[QNum][2]) - 1) / (Status[QNum][1].length - 1); //If less than zero, set to zero if (Status[QNum][3] < 0){Status[QNum][3] = 0;} } } //Check whether the quiz is finished var Finished = true; for (var i=0; i' + YourScoreIs + ' ' + Score + '%.'; } if (Finished == true){ EraseFeedback = false; var CFT = 0; for (i=0; i 0){ WriteFeedback(Output); } } function CheckAnswer(QNum, ANum){ var Output = I[QNum][1][ANum][1]; if (Output==''){ if (I[QNum][1][ANum][2] == 1){ Output = DefaultRight; } else{ Output = DefaultWrong; } } //If it's not been previously answered correctly if (Status[QNum][0] == 0){ //If it's a correct answer if (I[QNum][1][ANum][2] == 1){ Status[QNum][0] = 1;//Mark the Q as done Status[QNum][1][ANum] = 'R'; MarkAnswer(QNum, ANum, true); //Calculate the score for this question as a floating-point fraction of 1 var PossibleWrongs = 0; for (var i=0; i' + YourScoreIs + ' ' + Score + '%.'; } if (Finished == true){ EraseFeedback = false; var CFT = 0; for (i=0; i 0){ WriteFeedback(Output); } } function CalculateScore(){ var TriedQs = 0; var TotalScore = 0; for (var i=0; i 0)||(Status[i][3] == 1)){ TriedQs++; TotalScore += Status[i][3]; } } if (TriedQs == 0){ Score = 0; } else{ Score = (Math.floor(100 * (TotalScore/TriedQs))); } } function MarkAnswer(QNum, ANum, Right){ var Mark = CorrectIndicator; if (Right == false){Mark = IncorrectIndicator;} if (eval('BottomFrame.document.QForm.FB_' + QNum + '_' + ANum) != null){ eval('BottomFrame.document.QForm.FB_' + QNum + '_' + ANum).value = Mark; } } function CheckCheckbox(QNum, ANum){ if (eval('BottomFrame.document.QForm.A_' + QNum + '_' + ANum) != null){ eval('BottomFrame.document.QForm.A_' + QNum + '_' + ANum).checked = true; } } function ShowReading(){ if (ReadingFrame != null){ if (ReadingURL.length > 0){ ReadingFrame.location.href=ReadingURL; } else{ ReadingFrame.document.clear(); ReadingFrame.document.open(); ReadingFrame.document.write(ReadingText); ReadingFrame.document.close(); } } } //Reading text/timer code var min var sec var ShowReadingAgain = 'Start again...'; function DownTime(mm,ss){ min = mm; sec = ss; if (sec==0) { sec = 60; min--; } sec--; if (sec<10){ sec="0" + sec; } if (TimerFrame.document.TimerForm.face == null){ return; } TimerFrame.document.TimerForm.face.value= min+":"+sec; if ((min==0) && (sec==0)){ TimesUp() } else{ setTimeout('DownTime(min,sec)',1000) } } function StartReading(){ Stuff='Remaining time:'; Stuff+=' '; WriteToTimer(Stuff); ShowReading(); timeoutID=setTimeout('DownTime(3,0)',1000); } function TimesUp() { var Stuff = ''; if (ShowReadingAgain.length > 0) { Stuff=''; WriteToTimer(Stuff); } WriteToReading('Your time is over!'); } function WriteToReading(Stuff) { if (is.CRAPBrowser){Stuff=ResolveAllURLs(Stuff);} ReadingFrame.document.clear(); ReadingFrame.document.open(); ReadingFrame.document.writeln (''); ReadingFrame.document.writeln ('
'); ReadingFrame.document.writeln ('
'; QRow += '[QNumber][Question]
 '; QRow += '
[Ans]
'; MARow += '[Ans]
0){ history.go((BackSkip+1)*-1); } else{ parent.history.back(); } } function ReduceItems(){ var ItemToDump=0; var j=0; while (I.length > QsToShow){ ItemToDump = Math.floor(I.length*Math.random()); for (j=ItemToDump; j<(I.length-1); j++){ I[j] = I[j+1]; } I.length = I.length-1; } } function Shuffle(InArray){ Temp = new Array(); var Len = InArray.length; var j = Len; for (var i=0; i
'; OutString += '
'; OutString += NavBar; if (Feedback.length>0){ OutString += '' } OutString += '
'; OutString += ''; OutString += Feedback; OutString += '
'; if (is.CRAPBrowser){OutString=ResolveAllURLs(OutString);} //Write it to the frame TopFrame.document.clear(); TopFrame.document.open(); TopFrame.document.write(OutString); TopFrame.document.close(); } function StartUp(){ //Try to get user name UserName = prompt('Nome Cognome Matricola: ',''); UserName += ''; if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){ UserName = prompt('Nome Cognome Matricola: ',''); UserName += ''; if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){ window.location = PreviousPage; } } //Reduce array if required if (QsToShow < I.length){ ReduceItems(); } //Shuffle stuff if required if (ShuffleQs == true){ I = Shuffle(I); } if (ShuffleAs == true){ for (var i=0; i= Status[QNum][1].length-1){ Status[QNum][0] = 1; for (var i=0; i-1){ FirstBit = InString.substring(0, i); LastBit = InString.substring(i + Token.length, InString.length); InString = FirstBit + Replacement + LastBit; i = InString.indexOf(Token); } return InString; } function ChangeQ(ChangeBy){ var NewNum = CurrQNum + ChangeBy; if ((NewNum >= 0)&&(NewNum
'; OutString += '
'; OutString += TitleCode; OutString += ''; OutString += NavBar; OutString += '
'; OutString += ''; OutString += StuffToDisplay; OutString += '
'; if (is.CRAPBrowser){OutString=ResolveAllURLs(OutString);} //Write it to the frame BottomFrame.document.clear(); BottomFrame.document.open(); BottomFrame.document.write(OutString); BottomFrame.document.close(); } function ShowAllQs(){ var Output = ''; for (var i=0; i

'); ReadingFrame.document.writeln ('
') ReadingFrame.document.writeln (''); ReadingFrame.document.writeln (Stuff); ReadingFrame.document.writeln ('
'); ReadingFrame.document.close(); } function WriteToTimer(Stuff){ if (is.CRAPBrowser){Stuff=ResolveAllURLs(Stuff);} TimerFrame.document.clear(); TimerFrame.document.open(); TimerFrame.document.writeln (''); TimerFrame.document.writeln ('
'); TimerFrame.document.writeln ('
'); TimerFrame.document.writeln ('
') TimerFrame.document.writeln (''); TimerFrame.document.writeln (Stuff); TimerFrame.document.writeln ('
'); TimerFrame.document.close(); } function SendResults(Score){ var today = new Date; var NewName = '' + today.getTime(); var NewWin = window.open('', NewName, 'toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=yes,resizable=no,,width=400,height=300'); NewWin.document.clear(); NewWin.document.open(); NewWin.document.write(ResultForm); NewWin.document.close(); NewWin.document.Results.Score.value = Score + '%'; NewWin.document.Results.realname.value = UserName; NewWin.document.Results.End_Time.value = (new Date()).toLocaleString(); NewWin.document.Results.Start_Time.value = StartTime; NewWin.document.Results.submit(); } function Blank(){ return '
©Half-Baked Software. Loading...
'; } //--> //]]>
-->