'; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += '
'; var NavBar=''; NavBar+='
'; NavBar+=''; NavBar+=''; NavBar+=''; NavBar+='
'; var TitleCode = ''; TitleCode += '' + ExerciseTitle + '
'; TitleCode += '' + ExerciseSubtitle + '
'; TitleCode += '
'; var WordBox = ''; var ClozeOpener = ''; ClozeOpener += ''; var Buttons = '
'; ClozeOpener += '
'; var ClozeCloser = '
'; Buttons += '
'; Buttons += ''; Buttons += ''; Buttons += '
'; var GapCode = ''; var ClueButton = ''; ClueButton = ''; function GoBack(){ var BackSkip = history.length - PreviousPage; if (BackSkip > 0){ history.go((BackSkip+1)*-1); } else{ parent.history.back(); } } function BuildExercise(){ var OutString = ''; var ClozeStuff = ''; for (var i=0; i'; } else{ GapLen = I[i][1][0][0].length; if (GapLen < 3){GapLen = 3;} Gap = ReplaceStuff('[strGapSize]', GapLen, GapCode); Gap = ReplaceStuff('[strGapName]', 'Gap' + i + '', Gap); Gap = ReplaceStuff('[strItemNum]', i + '', Gap); Gap = ReplaceStuff('[strValue]', State[i][5], Gap); ClozeStuff += Gap; //Create and add the clue button if (I[i][2].length > 0){ Btn = ReplaceStuff('[strItemNum]', i + '', ClueButton); ClozeStuff += Btn; } } } //Add the last bit if (Text.length > I.length){ ClozeStuff += Text[Text.length-1]; } //Put the final pieces together OutString = ClozeOpener + ClozeStuff + ClozeCloser + Buttons; BuiltCloze = OutString; } function WriteFeedback(Feedback) { if (is.CRAPBrowser){Feedback=ResolveAllURLs(Feedback);} //Build the output string var OutString = ''; OutString += ''; OutString += '
'; OutString += '
'; OutString += NavBar; if (Feedback.length>0){ OutString += '' } OutString += '
'; OutString += ''; OutString += Feedback; OutString += '
'; //Write it to the frame TopFrame.document.clear(); TopFrame.document.open(); TopFrame.document.write(OutString); TopFrame.document.close(); } function DisplayExercise(){ //Build the output string var OutString = ''; OutString += ''; OutString += '
'; OutString += '
'; OutString += TitleCode; OutString += ''; OutString += NavBar; OutString += '
'; if (WordBox.length > 0){ OutString += WordBox; } OutString += ''; OutString += BuiltCloze; 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 ShowClue(ItemNum){ //alert(ItemNum); State[ItemNum][0] = 1; WriteFeedback(I[ItemNum][2]); } function SaveCurrentAnswers(){ 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; } var LowerString='abcdefghijklmnopqrstuvwxyz%9A%9C%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9%EA%EB%EC%ED%EE%EF%F0%F1%F2%F3%F4%F5%F6%F8%F9%FA%FB%FC%FD%FE%FF'; var UpperString='ABCDEFGHIJKLMNOPQRSTUVWXYZ%8A%8C%C0%C1%C2%C3%C4%C5%C6%C7%C8%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D8%D9%DA%DB%DC%DD%DE%9F'; LowerString = unescape(LowerString); UpperString = unescape(UpperString); I = new Array(); I[0] = new Array(); I[0][1] = new Array(); I[0][1][0] = new Array(); I[0][1][0][0]='I were'; I[0][2]='I was; I were; me were; me'; I[1] = new Array(); I[1][1] = new Array(); I[1][1][0] = new Array(); I[1][1][0][0]='which'; I[1][1][1] = new Array(); I[1][1][1][0]='that'; I[1][2]='then; what; which; that'; I[2] = new Array(); I[2][1] = new Array(); I[2][1][0] = new Array(); I[2][1][0][0]='very'; I[2][2]='extremely; very; much; lot'; I[3] = new Array(); I[3][1] = new Array(); I[3][1][0] = new Array(); I[3][1][0][0]='So'; I[3][2]='After; There; So; Since'; I[4] = new Array(); I[4][1] = new Array(); I[4][1][0] = new Array(); I[4][1][0][0]='didn\'t have'; I[4][2]='don\'t; had not; have not; didn\'t have'; I[5] = new Array(); I[5][1] = new Array(); I[5][1][0] = new Array(); I[5][1][0][0]='steal'; I[5][2]='steal; rob; rape; robbing'; I[6] = new Array(); I[6][1] = new Array(); I[6][1][0] = new Array(); I[6][1][0][0]='possible'; I[6][2]=''; I[7] = new Array(); I[7][1] = new Array(); I[7][1][0] = new Array(); I[7][1][0][0]='degrees'; I[7][2]=''; I[8] = new Array(); I[8][1] = new Array(); I[8][1][0] = new Array(); I[8][1][0][0]='degrees'; I[8][2]=''; I[9] = new Array(); I[9][1] = new Array(); I[9][1][0] = new Array(); I[9][1][0][0]='to put'; I[9][2]='to break; to smash; to crumble; to put'; I[10] = new Array(); I[10][1] = new Array(); I[10][1][0] = new Array(); I[10][1][0][0]='would'; I[10][2]=''; I[11] = new Array(); I[11][1] = new Array(); I[11][1][0] = new Array(); I[11][1][0][0]='we\'d'; I[11][2]='we\'d; we must; we could; we have to'; I[12] = new Array(); I[12][1] = new Array(); I[12][1][0] = new Array(); I[12][1][0][0]='what'; I[12][2]=''; I[13] = new Array(); I[13][1] = new Array(); I[13][1][0] = new Array(); I[13][1][0][0]='a'; I[13][2]='the; an; a; at'; I[14] = new Array(); I[14][1] = new Array(); I[14][1][0] = new Array(); I[14][1][0][0]='up'; I[14][2]=''; I[15] = new Array(); I[15][1] = new Array(); I[15][1][0] = new Array(); I[15][1][0][0]='beating'; I[15][2]='punching; beating; pulsing; jumping'; I[16] = new Array(); I[16][1] = new Array(); I[16][1][0] = new Array(); I[16][1][0][0]='up'; I[16][2]=''; I[17] = new Array(); I[17][1] = new Array(); I[17][1][0] = new Array(); I[17][1][0][0]='which'; I[17][2]=''; I[18] = new Array(); I[18][1] = new Array(); I[18][1][0] = new Array(); I[18][1][0][0]='help'; I[18][2]='people; waking; helping; help'; I[19] = new Array(); I[19][1] = new Array(); I[19][1][0] = new Array(); I[19][1][0][0]='in fact'; I[19][2]='eventually; just; in fact; right'; I[20] = new Array(); I[20][1] = new Array(); I[20][1][0] = new Array(); I[20][1][0][0]='over'; I[20][2]='over; up; next; nearest'; I[21] = new Array(); I[21][1] = new Array(); I[21][1][0] = new Array(); I[21][1][0][0]='Be'; I[21][2]=''; I[22] = new Array(); I[22][1] = new Array(); I[22][1][0] = new Array(); I[22][1][0][0]='it'; I[22][1][1] = new Array(); I[22][1][1][0]='he'; I[22][2]='him; this; it; here'; I[23] = new Array(); I[23][1] = new Array(); I[23][1][0] = new Array(); I[23][1][0][0]='able'; I[23][2]=''; I[24] = new Array(); I[24][1] = new Array(); I[24][1][0] = new Array(); I[24][1][0][0]='which'; I[24][2]=''; I[25] = new Array(); I[25][1] = new Array(); I[25][1][0] = new Array(); I[25][1][0][0]='some'; I[25][1][1] = new Array(); I[25][1][1][0]='a few'; I[25][2]='any; more; just; some'; Text = new Array(); Text[0]='My husband and '; Text[1]=' traveling in Africa and we were staying in a government guest house '; Text[2]=' was sort of like a small hotel, but it a wasn\'t a very smart place. Anyway it was a '; Text[3]=' hot night, that night. It was a very hot climate and it was really hot that night. '; Text[4]=' we wanted to have the windows open. But the problem was we had everything we owned right there in t'; Text[4]+='he room. And the windows '; Text[5]=' any screens or anything. So anybody could just come right in and '; Text[6]=' our things. But if we shut the windows, it would be im'; Text[7]=' to sleep, it was way over a hundred '; Text[8]=' Fahrenheit or forty '; Text[9]=' centigrade. So we decided '; Text[10]=' a lot of pots and pans under the window. So then if a thief came in, the pots and pans '; Text[11]=' fall down and '; Text[12]=' wake up. So that\'s '; Text[13]=' we did.
Anyway, we were asleep.
All of '; Text[14]=' sudden in the middle of the night, sure enough, I hear the pans crash. I sat '; Text[15]=' in bed. My heart was '; Text[16]=' like anything. I could see that there was a man in a white robe standing '; Text[17]=' next to the bed. I tried to scream but I had laryngitis, '; Text[18]=' means my voice wasn\'t working. And I was screaming in the local language for '; Text[19]='. But '; Text[20]=' I couldn\'t scream at all.
And so the man came '; Text[21]=' and he shoved me down on the bed. And then he says in English: "'; Text[22]=' quiet". At that moment I realized '; Text[23]=' was my husband and... - and when I was '; Text[24]=' to speak again, I said: "What\'re you doing?" to '; Text[25]=' he replied "well, I had a headache and I was trying to get '; Text[26]=' aspirins."'; State = new Array(); CharList = new Array(); EscapeList = new Array(); function StartUp(){ //Try to get user name UserName = prompt('Please enter your name and ID number',''); UserName += ''; if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){ UserName = prompt('Please enter your name and ID number',''); UserName += ''; if ((UserName.substring(0,4) == 'null')||(UserName.length < 1)){ window.location = PreviousPage; } } var i = 0; for (i=0; i 0){ OutString += FoundCode; } else{ OutString += NextChar; } } return OutString; } var MacChars = '%80%81%82%83%84%85%86%87%88%89%8A%8B%8C%8D%8E%8F%90%91%92%93%94%95%96%97%98%99%9A'; MacChars += '%9B%9C%9D%9E%9F%A0%A1%A4%A5%A6%A7%A8%AA%AB%AC%AE%AF%B4%B6%BB%BC%BE%BF%C0%C1%C2%C4%C7%C8'; MacChars += '%C9%CA%CB%CC%CD%CE%CF%D0%D1%D2%D3%D4%D5%D6%D8%D9%DA%DB%DC%DD%E0%E1%E2%E3%E4%E5%E6%E7%E8%E9'; MacChars += '%EA%EB%EC%ED%EE%EF%F1%F2%F3%F4%F5%F6%F7%F8%FB%FD'; var WinChars = '%C4%C5%C7%C9%D1%D6%DC%E1%E0%E2%E4%E3%E5%E7%E9%E8%EA%EB%ED%EC%EE%EF%F1%F3%F2%F4'; WinChars += '%F6%F5%FA%F9%FB%FC%86%BA%A7%95%B6%DF%AE%99%92%A8%C6%D8%A5%F0%AA%BA%E6%F8%BF%A1%AC%83%AB%BB'; WinChars += '%85%82%C0%C3%D5%8C%9C%96%97%93%94%91%92%F7%FFY/%A4%8B%9B%87%B7%82%84%89%C2%CA%C1%CB'; WinChars += '%C8%CD%CE%CF%CC%D3%D4%D2%DA%DB%D9%B9%88%98%AF%B0%94'; WinChars = unescape(WinChars); MacChars = unescape(MacChars) function MacStringToWin(InString){ var OutString = ''; for (i=0; i '~') && (MacChars.indexOf(InString.charAt(i)) > -1) ){ OutString += WinChars.charAt(MacChars.indexOf(InString.charAt(i))); } else { OutString += InString.charAt(i); } } return OutString; } function WinStringToMac(InString){ var OutString = ''; for (i=0; i '~') && (WinChars.indexOf(InString.charAt(i)) > -1) ){ OutString += MacChars.charAt(WinChars.indexOf(InString.charAt(i))); } else { OutString += InString.charAt(i); } } return OutString; } function TrimString(InString){ var x = 0 if (InString.length != 0) { while ((escape(InString.charAt(InString.length - 1)) == '%20') || (escape(InString.charAt(InString.length - 1)) == '%0A') || (escape(InString.charAt(InString.length - 1)) == '%0D')){ InString = InString.substring(0, InString.length - 1) } while ((escape(InString.charAt(0)) == '%20') || (escape(InString.charAt(0)) == '%0A') || (escape(InString.charAt(0)) == '%0D')){ InString = InString.substring(1, InString.length) } while (InString.indexOf(' ') != -1) { x = InString.indexOf(' ') InString = InString.substring(0, x) + InString.substring(x+1, InString.length) } return InString; } else { return ''; } } function ConvertCase(InString, Direction){ var FromString = ''; var ToString = ''; if (Direction == 0){ FromString = UpperString; ToString = LowerString; } else{ FromString = LowerString; ToString = UpperString; } var i = 0; j = 0; var OutString = ''; for (i=0; i -1){ j = FromString.indexOf(InString.charAt(i)); OutString += ToString.charAt(j); } else{ OutString += InString.charAt(i); } } return OutString; } function CheckAnswers(){ SaveCurrentAnswers(); var AllCorrect = 1; //Check each answer for (var i = 0; i< I.length; i++){ if (State[i][4] != 1){ //If it's right, calculate its score if (CheckAnswer(i, true) > -1){ var TotalChars = GetGapValue(i).length; State[i][3] = (TotalChars-State[i][1])/TotalChars; if (State[i][0] > 0){State[i][3] = State[i][3]/2;} if (State[i][3]<0){State[i][3] = 0;} State[i][4] = 1; } else{ //Otherwise, add zero to the array and increment the hints for this item, as a penalty State[i][1]++; State[i][3] = 0; //then set the flag AllCorrect = 0; } } } //Calculate the total score var TotalScore = 0; for (i=0; i'; } Output += YourScoreIs + ' ' + TotalScore + '%.
'; if (AllCorrect == 0){ Output += '
' + Incorrect; } BuildExercise(); WriteFeedback(Output); if (AllCorrect==1){ setTimeout('SendResults(' + TotalScore + ')', 50); return; } DisplayExercise(); RestoreCurrentAnswers(); } function TrackFocus(BoxNumber){ CurrentWord = BoxNumber; } function CheckBeginning(Guess, Answer){ var OutString = ''; var i = 0; var UpperGuess = ''; var UpperAnswer = ''; if (CaseSensitive == false) { UpperGuess = ConvertCase(Guess, 1); UpperAnswer = ConvertCase(Answer, 1); } else { UpperGuess = Guess; UpperAnswer = Answer; } while (UpperGuess.charAt(i) == UpperAnswer.charAt(i)) { OutString += Guess.charAt(i); i++; } OutString += Answer.charAt(i); return OutString; } function FindLongest(InArray){ if (InArray.length < 1){return -1;} var Longest = 0; for (var i=1; i InArray[Longest].length){ Longest = i; } } return Longest; } function GetGapValue(GNum){ var RetVal = ''; if ((GNum<0)||(GNum>=I.length)){return RetVal;} if (eval('BottomFrame.document.Cloze.Gap' + GNum) != null){ RetVal = eval('BottomFrame.document.Cloze.Gap' + GNum).value; if (FlipChars==true){RetVal = MacStringToWin(RetVal);} RetVal = TrimString(RetVal); } else{ RetVal = State[GNum][5]; } return RetVal; } function SetGapValue(GNum, Val){ if ((GNum<0)||(GNum>=I.length)){return;} if (FlipChars==true){Val = WinStringToMac(Val);} if (eval('BottomFrame.document.Cloze.Gap' + GNum) != null){ eval('BottomFrame.document.Cloze.Gap' + GNum).value = Val; } } function FindCurrent() { var x = 0; FoundCurrent = -1; //Test the current word: //If it's state is not set to already correct, check the word. if (State[CurrentWord][4] != 1){ if (CheckAnswer(CurrentWord, false) < 0){ return CurrentWord; } } x=CurrentWord + 1; while (x -1){return ''} RightBits = new Array(); for (var i=0; i 0){ SetGapValue(CurrGap, HintString); State[CurrGap][1] = State[CurrGap][1] + 1; } WriteFeedback(GiveHint); } 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...
'; } //--> //]]>
-->