var lingDRILL=new Object();lingDRILL.isLoggedIn=false;lingDRILL.testType=-1;lingDRILL.wordID=0;lingDRILL.fromLanguageID=-1;lingDRILL.verbs=null;lingDRILL.postResultsCalled=false;lingDRILL.timeInterval=null;lingDRILL.packItemIDs=null;lingDRILL.numTestFlashcards=0;lingDRILL.returnURL=null;lingDRILL.assignmentID=0;lingDRILL.index16=3;lingDRILL.index17=3;lingDRILL.index24=4;lingDRILL.index45=3;lingDRILL.articles16=[["je"],["tu"],["il","elle","on"],["nous"],["vous"],["ils","elles"]];lingDRILL.articlesImp16=[null,null,null,["tu"],["nous"],["vous"]];lingDRILL.articlesLiaison16=[["j'"],["tu"],["il","elle","on"],["nous"],["vous"],["ils","elles"]];lingDRILL.articles17=[["ich"],["du"],["er","sie (sing.)","es"],["wir"],["ihr"],["sie (pl.)","Sie"]];lingDRILL.articlesImp17=[null,null,["du"],["ihr"],["wir"],["Sie (pl.)"]];lingDRILL.articles24=[["io"],["tu"],["lui","lei","Lei"],["noi"],["voi"],["loro","Loro"]];lingDRILL.articlesImp24=[null,["tu"],["lui","lei","Lei"],["noi"],["voi"],["loro"]];lingDRILL.articles45=[["yo"],["t\xFA"],["\xE9l","ella","usted"],["nosotros","nosotras"],["vosotros","vosotras"],["ellos","ellas","ustedes"]];lingDRILL.articlesImp45=[null,["t\xFA"],["usted"],["nosotros","nosotras"],["vosotros","vosotras"],["ustedes"]];lingDRILL.conjNames16=["pr\xE9sent","imparfait","pass\xE9 simple","futur simple","pr\xE9sent (conditionnel)","pr\xE9sent (subjonctif)","imparfait (subjonctif)","pass\xE9 compos\xE9","plus-que-parfait","pass\xE9 ant\xE9rieur","futur ant\xE9rieur","pass\xE9 (conditionnel)","pass\xE9 (subjonctif)","plus-que-parfait (subjonctif)","imp\xE9ratif"];lingDRILL.conjNames17=["Pr\xE4sens","Pr\xE4teritum","Perfekt","Plusquamperfekt","Futur","Futur Perfekt","Pr\xE4sens (Konjunktiv)","Perfekt (Konjunktiv)","Pr\xE4teritum (Konjunktiv)","Plusquamperfekt (Konjunktiv)","Futur (Konjunktiv)","Futur Perfekt (Konjunktiv)","Pr\xE4sens (Konditional)","Perfekt (Konditional)","Imperativ"];lingDRILL.conjNames24=["presente","imperfetto","passato remoto","futuro","presente condizionale","presente congiuntivo","imperfetto congiuntivo","passato prossimo","trapassato prossimo","trapassato remoto","futuro anteriore","passato condizionale","passato prossimo congiuntivo","trapassato prossimo congiuntivo","imperativo"];lingDRILL.conjNames45=["presente","imperfecto","pret\xE9rito","futuro simple","condicional simple","presente (subj)","imperfecto 1 (subj)","imperfecto 2 (subj)","pret\xE9rito perfecto","pluscuamperfecto","pret\xE9rito anterior","futuro perfecto","condicional perfecto","pret\xE9rito perfecto (subj)","pluscuamperfecto 1 (subj)","pluscuamperfecto 2 (subj)","imperativo","futuro simple (subj)","futuro perfecto (subj)"];lingDRILL.impIndex16=14;lingDRILL.impIndex17=14;lingDRILL.impIndex45=16;lingDRILL.flashcards=null;lingDRILL.savedFlashcards=null;lingDRILL.current=null;lingDRILL.numRight=0;lingDRILL.numWrong=0;lingDRILL.numOverridden=0;lingDRILL.startTime=0;lingDRILL.pingInterval=null;lingDRILL.updateTime=function(){var B=lingTEST.getTimeElapsed();B=Math.floor(B/1000);var A=B%60;B=Math.floor(B/60);var C=B%60;B=Math.floor(B/60);xGetElementById("timeElapsed").innerHTML=B+":"+Math.floor(C/10)+(C%10)+":"+Math.floor(A/10)+(A%10)};lingDRILL.updateStats=function(){xGetElementById("numRight").innerHTML=lingDRILL.numRight;xGetElementById("numWrong").innerHTML=lingDRILL.numWrong;xGetElementById("numOverridden").innerHTML=lingDRILL.numOverridden;if(lingDRILL.flashcards){xGetElementById("numRemaining").innerHTML=lingDRILL.getNumRemaining()}};lingDRILL.onLoad=function(){setVisibility("divChoose",(lingDRILL.drillFlags&~lingTEST.DRILLFLAG_VERB_ALL_SUBJECTS)==0);setVisibility("divStartButton",(lingDRILL.drillFlags&~lingTEST.DRILLFLAG_VERB_ALL_SUBJECTS)!=0)};lingDRILL.currentOverride=function(){lingDRILL.current.numOverridden++;lingDRILL.numOverridden++;lingDRILL.currentRight()};lingDRILL.currentRight=function(){lingDRILL.current.numRight++;lingDRILL.current.timeElapsed+=(new Date()).getTime()-lingDRILL.current.startTime;lingDRILL.numRight++};lingDRILL.currentWrong=function(){var A;var B=lingDRILL.flashcards.length;if(B>30){B=30}if(B==0||(lingDRILL.flashcards[B-1]!=lingDRILL.current)&&(B==lingDRILL.flashcards.length||lingDRILL.flashcards[B]!=lingDRILL.current)){for(A=lingDRILL.flashcards.length;A>B;A--){lingDRILL.flashcards[A]=lingDRILL.flashcards[A-1]}lingDRILL.flashcards[B]=lingDRILL.current}B=Math.floor(B/3);if(B>0&&lingDRILL.flashcards[B-1]!=lingDRILL.current&&lingDRILL.flashcards[B]!=lingDRILL.current){for(A=lingDRILL.flashcards.length;A>B;A--){lingDRILL.flashcards[A]=lingDRILL.flashcards[A-1]}lingDRILL.flashcards[B]=lingDRILL.current}lingDRILL.current.numWrong++;lingDRILL.current.timeElapsed+=(new Date()).getTime()-lingDRILL.current.startTime;lingDRILL.numWrong++};lingDRILL.getNumRemaining=function(){return lingDRILL.flashcards.length};lingDRILL.startTest=function(A,H,K){lingDRILL.pingInterval=setInterval(lingAPI.ping,120000);lingDRILL.flashcards=new Array();lingDRILL.savedFlashcards=new Array();lingTEXT.showAccentHelp("hlpAccent",lingDRILL.fromLanguageID,"txtAnswer","answerAccents");var J=K&lingTEST.DRILLFLAG_VERB_ALL_SUBJECTS;K>>=6;var I=lingDRILL["index"+lingDRILL.fromLanguageID];var E=0;var D;var B;var M=lingDRILL["impIndex"+lingDRILL.fromLanguageID];while(K!=0){if((K&1)!=0){for(var L=0;L<A.length;L++){if(E==M){D=A[L].articlesImp;B=A[L].articlesImp}else{D=A[L].articles;B=A[L].articlesLiaison}for(var G=0;G<6;G++){if((J&(1<<G))!=0&&A[L][I+G]!=null){if(A[L][I+G].length>0){var F=new Object();F.verb=A[L];F.words=A[L][I+G];var C=stripAccentFromCharCode(F.words[0].charCodeAt(0));F.article=(C==97||C==101||C==105||C==111||C==117||(C==104&&A[L].liaison))?B[G]:D[G];F.conjName=H[E];F.numRight=0;F.numWrong=0;F.numOverridden=0;F.timeElapsed=0;lingDRILL.flashcards[lingDRILL.flashcards.length]=F;lingDRILL.savedFlashcards[lingDRILL.savedFlashcards.length]=F}}}}}E++;I+=6;K>>=1}lingDRILL.numTestFlashcards=lingDRILL.flashcards.length;lingDRILL.startTime=(new Date()).getTime();lingDRILL.numRight=0;lingDRILL.numWrong=0;lingDRILL.numOverridden=0;showElement("btnPause");lingTEST.randomizeList(lingDRILL.flashcards);lingDRILL.gotoNext()};lingDRILL.doCheck=function(B,A){if(B.checked){lingDRILL.drillFlags|=A}else{lingDRILL.drillFlags&=~A}setVisibility("divStartButton",(lingDRILL.drillFlags&~lingTEST.DRILLFLAG_VERB_ALL_SUBJECTS)!=0&&(lingDRILL.drillFlags&lingTEST.DRILLFLAG_VERB_ALL_SUBJECTS)!=0)};lingDRILL.getIsCorrect=function(A,G,B,E){var F=trim(A);var D;F=normalizeFullHalf(F);if(B){F=F.toUpperCase()}if(E){F=stripAccents(F)}F=stripPunctuation(F);F=lingWRITE.normalize(F);for(var C=0;C<G.length;C++){D=G[C];if(D.length>0){if(B){D=D.toUpperCase()}if(E){D=stripAccents(D)}D=stripPunctuation(D);D=lingWRITE.normalize(D);if(matches(F,D)){return G[C]}}}return null};lingDRILL.hideRight=function(){hideElement("answerTable");hideElement("rightRow");hideElement("rightButtons");showElement("okButtonRow")};lingDRILL.hideWrong=function(){hideElement("answerTable");hideElement("wrongRow");hideElement("wrongButtons");showElement("okButtonRow")};lingDRILL.doOnRight=function(){lingDRILL.currentRight();lingDRILL.updateStats();hideElement("okButtonRow");showElement("answerTable");showElement("rightRow");showElement("rightButtons");xGetElementById("rightContinue").focus();xGetElementById("txtAnswer").readOnly=true};lingDRILL.doOnWrong=function(){hideElement("okButtonRow");showElement("answerTable");showElement("wrongRow");showElement("wrongButtons");xGetElementById("wrongContinue").focus();node=xGetElementById("txtAnswer");node.readOnly=true};lingDRILL.okDebounce=false;lingDRILL.doOnOK=function(){if(!lingDRILL.okDebounce){lingDRILL.okDebounce=true;hideElement("okButtonRow");var A=xGetElementById("txtAnswer");if(lingDRILL.getIsCorrect(A.value,lingDRILL.current.words,xGetElementById("ignoreCase").checked,xGetElementById("ignoreDiacritics").checked)){lingDRILL.doOnRight()}else{lingDRILL.doOnWrong()}}};lingDRILL.doOnOverride=function(){lingDRILL.hideWrong();lingDRILL.currentOverride();lingDRILL.updateStats();lingDRILL.gotoNext()};lingDRILL.doOnContinue=function(A){if(A){lingDRILL.hideRight()}else{lingDRILL.hideWrong();lingDRILL.currentWrong();lingDRILL.updateStats()}lingDRILL.gotoNext()};lingDRILL.display=function(){if(lingDRILL.current==null){return }xGetElementById("answerHeader").innerHTML=lingDRILL.current.verb[0][0];xGetElementById("tenseHeader").innerHTML=lingDRILL.current.conjName;var E=lingDRILL.current.article[Math.floor(Math.random()*lingDRILL.current.article.length)];xGetElementById("lblArticle").innerHTML=E;node=xGetElementById("correctAnswers");while(node.hasChildNodes()){node.removeChild(node.childNodes[0])}var C=document.createElement("table");C.width="100%";C.cellPadding="6";C.cellSpacing="1";for(i=lingDRILL.current.words.length-1;i>=0;i--){var D=C.insertRow(0);var G=D.insertCell(0);var A=document.createElement("table");A.align="center";G.appendChild(A);var F=A.insertRow(0);var B=F.insertCell(0);B.align="center";B.className="header20";B.style.fontWeight="normal";B.innerHTML=lingDRILL.current.words[i]}node.appendChild(C)};lingDRILL.unDebounce=function(){lingDRILL.okDebounce=false};lingDRILL.gotoNext=function(){showElement("okButtonRow");setTimeout("lingDRILL.unDebounce()",10);lingDRILL.updateStats();lingDRILL.current=lingDRILL.flashcards.shift();if(lingDRILL.current==null){lingTEST.doEndTest();return }var A=xGetElementById("txtAnswer");A.value="";A.readOnly=false;lingDRILL.current.startTime=(new Date()).getTime();lingDRILL.display();xGetElementById("txtAnswer").focus();xGetElementById("txtAnswer").focus()};lingDRILL.doOnStart=function(){if(lingDRILL.drillFlags==0){alert(lingRESOURCES.write("DrillVerb.alert_noConjugations","You have to choose at least one conjugation before starting the drill!"))}else{lingTEST.hasBegun=true;hideElement("divChoose");hideElement("divStartButton");showElement("tdStats");showElement("divDrill");showElement("divEndTestButton");lingDRILL.startTest(lingDRILL.verbs,eval("lingDRILL.conjNames"+lingDRILL.fromLanguageID),lingDRILL.drillFlags);lingDRILL.timeInterval=setInterval(lingDRILL.updateTime,950)}};lingDRILL.getResultData=function(){var D="";var B=0;for(var A=lingDRILL.savedFlashcards.length-1;A>=0;A--){if(lingDRILL.savedFlashcards[A].numRight>0||lingDRILL.savedFlashcards[A].numWrong>0){if(B++>0){D+=","}D+=lingDRILL.savedFlashcards[A].verb.wordID+","+(lingDRILL.savedFlashcards[A].numRight+lingDRILL.savedFlashcards[A].numWrong)+","+lingDRILL.savedFlashcards[A].numWrong+","+lingDRILL.savedFlashcards[A].numOverridden+","+lingDRILL.savedFlashcards[A].timeElapsed}}var C=new Object();C.str=D;C.count=B;return C};lingTEST.postResults=function(D,O,L,N,A,E,M,H,J,C,K,I,B){if(!lingDRILL.postResultsCalled){lingDRILL.postResultsCalled=true;var G=lingDRILL.getResultData();var F={testType:D,fromLanguageID:O,toLanguageID:L,timeElapsed:A,numTestFlashcards:E,numSkipped:M,numOverridden:H,seed:J,packItemIDs:C,assignmentID:K,activityID:I};lingAPI.drillPostResults(D,O,L,A,M,H,E,J,G.count,C,K,I,lingTEST.homeworkID,lingTEST.uuid,G.str,B,null,F)}};lingTEST.doEndTest=function(){lingTEXT.setAllowBackspace(true);if(lingTEST.isPreview){window.close();return }if(lingDRILL.current==null||confirm(lingRESOURCES.write("Drill.confirm_doEndTest","Are you sure you want to quit the drill before you're done?"))){hideElement("divEndTestButton");hideElement("btnPause");hideElement("divPaused");if(lingDRILL.packItemIDs==null||lingDRILL.packItemIDs.length==0){location.replace(lingDRILL.returnURL!=null&&lingDRILL.returnURL.length>0?decodeUTF8(lingDRILL.returnURL):"Home.do")}else{if(lingDRILL.numRight>0||lingDRILL.numWrong>0){var B=lingDRILL.flashcards.length;if(lingDRILL.current!=null){B++}if(!lingDRILL.isLoggedIn){var A=0;var E=0;for(var C=0;C<lingDRILL.savedFlashcards.length;C++){if(lingDRILL.savedFlashcards[C].numRight>0||lingDRILL.savedFlashcards[C].numWrong>0){E++;if(lingDRILL.savedFlashcards[C].numRight==1&&lingDRILL.savedFlashcards[C].numWrong==0){A++}}}if(lingDRILL.returnURL!=null&&lingDRILL.returnURL.length>0){location.replace(lingDRILL.returnURL)}else{if(lingTEST.lessonID!=null){if(lingDRILL.current==null){lingTEST.showGotoNextActivity()}else{lingTEST.returnToLesson()}}else{location.replace("Scores.do?testType="+lingDRILL.testType+"&fromLanguageID="+lingDRILL.fromLanguageID+"&toLanguageID="+lingDRILL.fromLanguageID+"&timeElapsed="+lingTEST.getTimeElapsed()+"&numRight="+lingDRILL.numRight+"&numWrong="+lingDRILL.numWrong+"&numSkipped="+B+"&numCorrectFirstTime="+A+"&numOverridden="+lingDRILL.numOverridden+"&numTestFlashcards="+lingDRILL.numTestFlashcards+"&numStats="+E+"&seed="+lingDRILL.seed+"&packItemIDs="+lingDRILL.packItemIDs)}}}else{hideElement("divDrill");showElement("divEndTest");lingTEST.postResults(lingDRILL.testType,lingDRILL.fromLanguageID,lingDRILL.fromLanguageID,null,lingTEST.getTimeElapsed(),lingDRILL.numTestFlashcards,B,lingDRILL.numOverridden,lingDRILL.seed,lingDRILL.packItemIDs,lingDRILL.assignmentID,lingTEST.activityID,lingTEST.postResultsCB)}}else{if(lingTEST.isDemo){if(lingDRILL.returnURL!=null&&lingDRILL.returnURL.length>0){location.replace(lingDRILL.returnURL)}else{location.replace("QuickDemo.do")}}else{if(lingDRILL.assignmentID>0){if(lingDRILL.returnURL!=null&&lingDRILL.returnURL.length>0){location.replace(lingDRILL.returnURL)}else{location.replace("Course.do")}}else{if(lingDRILL.returnURL!=null&&lingDRILL.returnURL.length>0){location.replace(lingDRILL.returnURL)}else{if(lingTEST.lessonID!=null){lingTEST.returnToLesson()}else{var D=lingDRILL.packItemIDs.split(",");if(D.length>0){location.replace("List.do?packItemID="+D[0])}else{location.replace("Home.do")}}}}}}}}};