-->
'; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += ''; ResultForm += '
'; function CapFirst(InString){ var i = 0; if ((Openers.indexOf(InString.charAt(i))>-1)||(InString.charAt(i) == ' ')){ i++; } if ((Openers.indexOf(InString.charAt(i))>-1)||(InString.charAt(i) == ' ')){ i++; } var Temp = InString.charAt(i); Temp = Temp.toUpperCase(); InString = InString.substring(0, i) + Temp + InString.substring(i+1, InString.length); return InString; } function CheckResults(ChkType){ //Get sequence student has chosen GetGuessSequence(); //Compile the answer Output = CompileString(GuessSequence); //Check the answer CheckAnswer(ChkType); } function GetGuessSequence(){ //Put pointers to draggables in arrays based on the lines they're sitting on var Drops = new Array(); for (var i=0; i 0){ NewFirstDiv = Drops[i][0].index; break; } } return NewFirstDiv; } function CompDrags(a,b){ return a.GetL() - b.GetL(); } function FindSegment(SegID){ var Seg = ''; for (var i=0; i 0){ OutString = OutArray[0]; } else{ OutString = ''; } var Spacer = ''; for (i=1; i -1)||(Punctuation.indexOf(OutArray[i].charAt(0)) > -1)){ Spacer = ''; } OutString = OutString + Spacer + OutArray[i]; } //Capitalize the first letter if necessary if (CapitalizeFirst == true){ i = 0; if ((Openers.indexOf(OutString.charAt(i))>-1)||(OutString.charAt(i) == ' ')){ i++; } if ((Openers.indexOf(OutString.charAt(i))>-1)||(OutString.charAt(i) == ' ')){ i++; } var Temp = OutString.charAt(i); Temp = Temp.toUpperCase(); OutString = OutString.substring(0, i) + Temp + OutString.substring(i+1, OutString.length); } return OutString; } function CheckAnswer(CheckType){ if (GuessSequence.length < 1){ if (CheckType == 1){ Penalties++; WriteFeedback(NextCorrect + '

' + FindSegment(Answers[0][0]) + ''); } return; } var i = 0; var j = 0; var k = 0; var WellDone = ''; var WhichCorrect = -1; var TryAgain = ''; var LongestCorrectBit = ''; TempCorrect = new Array(); LongestCorrect = new Array(); var TempHint = ''; var HintToReturn = 1; var OtherAnswers = ''; for (i=0; i LongestCorrect.length){ LongestCorrect.length = 0; for (k=0; k -1){ for (i=0; i

' + CorrectResponse + '
'; //Do score calculation here var Score = Math.floor(((Segments.length-Penalties) * 100)/Segments.length); WellDone += YourScoreIs + ' ' + Score + '%.
'; WriteFeedback(WellDone); setTimeout('SendResults(' + Score + ')', 50); return; } else{ TryAgain = '' + CompileString(GuessSequence) + '

'; Penalties++; if ((CheckType == 0)||(LongestCorrect.length==0)){ TryAgain += IncorrectResponse + '
'; } if (LongestCorrect.length > 0){ LongestCorrectBit = CompileString(LongestCorrect); GuessSequence.length = LongestCorrect.length; TryAgain += '
' + ThisMuchCorrect + '
' + LongestCorrectBit + '
'; } if (CheckType == 1){ TryAgain += '
' + NextCorrect + '
' + FindSegment(HintToReturn); } WriteFeedback(TryAgain); } } var Segments = new Array(); Segments[0] = new Array(); Segments[0][0] = '[Rodney Dangerfield]'; Segments[0][1] = 10; Segments[0][2] = 0; Segments[1] = new Array(); Segments[1][0] = 'My wife and'; Segments[1][1] = 1; Segments[1][2] = 0; Segments[2] = new Array(); Segments[2][0] = 'Then we'; Segments[2][1] = 8; Segments[2][2] = 0; Segments[3] = new Array(); Segments[3][0] = 'twenty'; Segments[3][1] = 6; Segments[3][2] = 0; Segments[4] = new Array(); Segments[4][0] = 'years.'; Segments[4][1] = 7; Segments[4][2] = 0; Segments[5] = new Array(); Segments[5][0] = 'happy'; Segments[5][1] = 4; Segments[5][2] = 0; Segments[6] = new Array(); Segments[6][0] = 'were'; Segments[6][1] = 3; Segments[6][2] = 0; Segments[7] = new Array(); Segments[7][0] = 'met.'; Segments[7][1] = 9; Segments[7][2] = 0; Segments[8] = new Array(); Segments[8][0] = 'for'; Segments[8][1] = 5; Segments[8][2] = 0; Segments[9] = new Array(); Segments[9][0] = 'I'; Segments[9][1] = 2; Segments[9][2] = 0; var GuessSequence = new Array(); var Answers = new Array(); Answers[0] = new Array(1,2,3,4,5,6,7,8,9,10); function doDrag(e) { if (CurrDrag == -1) {return}; if (is.ie){var Ev = window.event}else{var Ev = e} var difX = Ev.clientX-window.lastX; var difY = Ev.clientY-window.lastY; var newX = C[CurrDrag].GetL()+difX; var newY = C[CurrDrag].GetT()+difY; C[CurrDrag].SetL(newX); C[CurrDrag].SetT(newY); window.lastX = Ev.clientX; window.lastY = Ev.clientY; return true; } function beginDrag(e, DragNum) { CurrDrag = DragNum; if (is.ie){ var Ev = window.event; document.onmousemove=doDrag; document.onmouseup=endDrag; } else{ var Ev = e; window.onmousemove=doDrag; window.onmouseup=endDrag; } C[CurrDrag].SwapColours(); topZ++; C[CurrDrag].css.zIndex = topZ; window.lastX=Ev.clientX; window.lastY=Ev.clientY; return true; } function endDrag(e) { if (CurrDrag == -1) {return}; C[CurrDrag].SwapColours(); if (is.ie){document.onmousemove=null}else{window.onmousemove=null;} onEndDrag(); CurrDrag = -1; return true; } function onEndDrag(){ //Snap to lines var i = 0; var SnapLine = C[CurrDrag].GetT(); var BiggestOverlap = -1; var OverlapRect = 0; for (i=0; i OverlapRect){ OverlapRect = C[CurrDrag].Overlap(L[i]); BiggestOverlap = i; } } if (BiggestOverlap > -1){ // SnapLine = L[BiggestOverlap].tag; SnapLine = L[BiggestOverlap].GetB() - (C[CurrDrag].GetH() + 2); C[CurrDrag].SetT(SnapLine); CheckOver(-1); } if (CapitalizeFirst==true){ setTimeout('DoCapitalization()', 50); } } function DoCapitalization(){ //Capitalize first segment if necessary var FD = GetGuessSequence(); if ((FD == -1)&&(FirstDiv > -1)){ C[FirstDiv].elm.innerHTML = Segments[FirstDiv][0]; } if (((FD != FirstDiv)&&(CapitalizeFirst == true))&&(FD > -1)){ if (FirstDiv > -1){ C[FirstDiv].elm.innerHTML = Segments[FirstDiv][0]; } } if ((FD > -1)&&(CapitalizeFirst == true)){ var Temp = CapFirst(Segments[FD][0]); C[FD].elm.innerHTML = Temp; FirstDiv = FD; } } function CheckOver(NoMove){ //This recursive function spreads out the Cards on a line if two of them are overlapping; //if the spread operation moves one beyond the end of a line, it wraps it to the next line. var Temp; for (var i=0; i 0){ if ((i==NoMove)||(C[i].GetL() < C[j].GetL())){ C[j].DockToR(C[i]); if (C[j].GetR() > (LeftColPos + DivWidth)){ C[j].SetL(LeftColPos); C[j].SetT(C[j].GetT() + DropHeight); } CheckOver(j); } else{ C[i].DockToR(C[j]); if (C[i].GetR() > (LeftColPos + DivWidth)){ C[i].SetL(LeftColPos); C[i].SetT(C[i].GetT() + DropHeight); } CheckOver(i); } } } } } } 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; } } Segments = Shuffle(Segments); //Calculate page dimensions and positions pg = new PageDim(); DivWidth = Math.floor((pg.W*4)/5); DragWidth = Math.floor((DivWidth*3)/10); LeftColPos = Math.floor(pg.W/10); RightColPos = pg.W - (DragWidth + LeftColPos); DragTop = parseInt(document.getElementById('TitleDiv').offsetHeight) + 10; //Position the feedback div var CurrDiv = document.getElementById('FeedbackDiv'); CurrDiv.style.top = DragTop + 5 + 'px'; CurrDiv.style.left = Math.floor((pg.W)/3) + 'px'; CurrDiv.style.width = Math.floor(pg.W/3) + 'px'; var CurrTop = DragTop + 10; //Position the drop divs for (var i=0; i'; //required for Navigator rendering bug with images C[i].SetT(CurrTop); C[i].SetL(LeftColPos); C[i].css.cursor = 'move'; TempInt = C[i].GetH(); CurrTop = CurrTop + TempInt + 5; C[i].css.backgroundColor = '#ffffff'; C[i].css.color = '#000000'; topZ++; C[i].css.zIndex = topZ; C[i].tag = Segments[i][1]; C[i].index = i; } //Place them at the bottom of the page SetInitialPositions(); } function SetInitialPositions(){ //Places all the divs at the bottom of the page in centred rows //First, get the vertical position of the first row var RTop = L[L.length-1].GetB() + 10; //Create an array to hold the numbers of Cards for each row CRows = new Array(); CRows[0] = new Array(); Widths = new Array(); var i=0; var r=0; var RowWidth=0; //Sort the Cards into rows, storing their numbers in the array while (i
'; Output += '
//]]>

Marriage counselling 2

Mixed-up sentence exercise
Put the parts in order to form a sentence by clicking on the words in the right order. When you think your answer is correct, click on "Check" to check your answer. If you get stuck, click on "Hint" to find out the next correct part.