var copyright="&copy;<a href=\"http://www.xunta.es/conselle/ceoug/dxoefp/index.htm\" target=\"_blank\">Direcci&oacute;n Xeral de Ordenaci&oacute;n Educativa e F.P.</a>, Xunta de Galicia. This site was developed during four months' paid leave from regular teaching work at <a href=\"http://sapiens.ya.com/meixoeiro\" target=\"_blank\">I.E.S. \"O Meixoeiro\"</a>, Vigo. This publication includes images from CorelDRAW&reg; 9 which are protected by the copyright laws of the U.S., Canada and elsewhere. Used under licence.";var rootDir="";var pageChosen=false;var chars=new MsaChars();var tinfo=new TechInfo();var ids=new Ids();var grls=new GrammarRules();var lfns=new LanguageFunctions();var lforms=new LanguageForms();function choosePage(){if(pageChosen)return;pageChosen=true;var s=location.search;if(s.length>1){s=s.substring(1,s.length)+".html";myframe.location.replace(s);}}function Ids(){this.count=0;}Ids.prototype.next=function(){return "id"+(this.count++);};function Rnd(length,n){this.last=new Array();this.length=length;this.maxIndex=Math.min(n,Math.floor(length*0.7));for(var i=0;i<this.maxIndex;i++)this.last[i]=-1;}Rnd.prototype.next=function(){var r=-1,n=0;while(r==-1&&n<30){n++;r=Math.floor(Math.random()*this.length);for(var i=0;i<this.maxIndex;i++){if(r==this.last[i]){r=-1;break;}}}for(var i=1;i<this.maxIndex;i++)this.last[i-1]=this.last[i];this.last[this.maxIndex-1]=r;return r;};function Presentation(owner,chars,title,msg){this.owner=owner;this.chars=chars;this.title=title;this.msg=msg;this.presCount=0;this.status=0;this.req1=null;this.req2=null;this.req3=null;this.req4=null;this.chars.requestCompleteOwner=this;this.balloonStyle=15;this.charSpeed=""}Presentation.prototype.start=function(){this.presCount++;this.chars.busy=true;if(typeof this.owner.createPresentation=="function")if(this.presCount>1)this.owner.prsdiv.innerHTML=this.owner.createPresentation();this.chars.stopAll();this.chars.c[0].char.Balloon.Style|=15;this.chars.c[0].show();this.chars.c[0].play("Wave");this.chars.c[0].play("RestPose");this.req1=this.chars.c[0].speak(lfns.introducePage(this.title)+this.msg);this.status=1;this.updateBtn();};Presentation.prototype.talk=function(text){if(this.status!=0)return;if(this.chars.busy)return;this.chars.busy=true;var r=Math.floor(Math.random()*9);switch(r){case 0:this.chars.c[0].play("Announce");break;case 1:this.chars.c[0].play("Explain");break;case 2:this.chars.c[0].play("Think");break;}this.req2=this.chars.c[0].speak(this.charSpeed+text);this.chars.c[0].play("RestPose");};Presentation.prototype.requestComplete=function(request){switch(request){case this.req1:this.chars.c[0].char.Balloon.Style&=this.balloonStyle;this.chars.busy=false;this.status=0;this.updateBtn();break;case this.req2:this.chars.busy=false;break;}};Presentation.prototype.btnClick=function(){if(this.status>0){this.status=0;this.chars.c[0].stopAll();}else{this.start();}this.updateBtn();};Presentation.prototype.updateBtn=function(){this.owner.prsbtn.style.visibility="visible";if(this.status>0){this.owner.prsimg.src=rootDir+"images/stop.gif";this.owner.prsimg.alt="Press to stop the introduction"}else{this.owner.prsimg.src=rootDir+"images/start.gif";this.owner.prsimg.alt="Press to listen to the introduction"}};function ListeningQuiz(owner,chars,title,msg){this.owner=owner;this.chars=chars;this.title=title;this.msg=msg;this.utype=0;this.uopt="";if(arguments.length>4)this.utype=arguments[4];if(arguments.length>5)this.uopt=arguments[5];this.items=new Array();this.keys=new Array();this.itemNo=0;this.itemCount=0;this.okCount=0;this.ok=true;this.status=0;this.req1=null;this.req2=null;this.req3=null;this.req4=null;this.chars.requestCompleteOwner=this;this.balloonStyle=15;this.charSpeed=""}ListeningQuiz.prototype.addItem=function(item,key){this.items[this.itemNo]=item;this.keys[this.itemNo]=key;this.itemNo++;};ListeningQuiz.prototype.start=function(){this.itemNo=0;this.itemCount=0;this.okCount=0;this.ok=true;this.chars.busy=true;this.owner.createQuiz();this.chars.stopAll();this.chars.c[0].char.Balloon.Style|=15;this.chars.c[0].show();this.chars.c[0].play("Wave");this.chars.c[0].play("RestPose");this.req1=this.chars.c[0].speak(lfns.introducePage(this.title)+this.msg);this.status=1;this.updateBtn();};ListeningQuiz.prototype.askItem=function(){if(this.status!=1)return;this.chars.busy=true;this.req2=this.chars.c[0].speak((this.ok ? "":"Now try this one: ")+this.charSpeed+this.items[this.itemCount]);};ListeningQuiz.prototype.processAnswer=function(answer,support){if(this.status!=2)return;this.chars.busy=true;var ut=new Utterance(answer,this.utype);if(ut.equals(this.keys[this.itemCount],this.uopt)){this.chars.c[0].play("Acknowledge");this.req3=this.chars.c[0].speak(lfns.confirm());this.okCount++;this.ok=true;}else{this.chars.c[0].play("Decline");this.req3=this.chars.c[0].speak(lfns.correct()+support);this.ok=false;}this.chars.c[0].play("RestPose");this.itemCount++;this.status=1;};ListeningQuiz.prototype.finish=function(){this.chars.c[0].char.Balloon.Style|=15;this.chars.busy=true;this.chars.c[0].actGrade(this.okCount,this.itemNo);this.req4=this.chars.c[0].speak(lfns.sayGrade(this.okCount,this.itemNo));this.chars.c[0].play("RestPose");};ListeningQuiz.prototype.requestComplete=function(request){switch(request){case this.req1:this.chars.c[0].char.Balloon.Style&=this.balloonStyle;this.chars.busy=false;this.askItem();break;case this.req2:this.chars.busy=false;if(this.req2.Status==0)this.status=2;break;case this.req3:if(this.itemCount<this.itemNo)this.askItem();else this.finish();break;case this.req4:this.chars.busy=false;this.status=0;this.updateBtn();this.chars.wnd.setTimeout("this.chars.c[0].actIdle()",10000);break;}};ListeningQuiz.prototype.btnClick=function(){if(this.status>0){if(!confirm("Are you sure you want to stop the quiz?"))return;this.status=0;this.chars.c[0].stopAll();}else{this.start();}this.updateBtn();};ListeningQuiz.prototype.updateBtn=function(){this.owner.qzbtn.style.visibility="visible";if(this.status>0){this.owner.qzimg.src=rootDir+"images/stop.gif";this.owner.qzimg.alt="Press to stop the quiz"}else{this.owner.qzimg.src=rootDir+"images/start.gif";this.owner.qzimg.alt="Press to start a new quiz"}};function WritingQuiz(owner,chars,title,msg){this.owner=owner;this.chars=chars;this.title=title;this.msg=msg;this.utype=0;this.uopt="";if(arguments.length>4)this.utype=arguments[4];if(arguments.length>5)this.uopt=arguments[5];this.keys=new Array();this.answers=new Array();this.itemNo=0;this.quizCount=0;this.status=0;this.req1=null;this.req2=null;this.req3=null;this.chars.requestCompleteOwner=this;this.balloonStyle=15;this.charSpeed="";}WritingQuiz.prototype.addItem=function(key){this.keys[this.itemNo]=key;this.itemNo++;};WritingQuiz.prototype.clear=function(){for(i=0;i<this.itemNo;i++){eval("this.owner.item"+i+".value = \"\"");}};WritingQuiz.prototype.start=function(){this.quizCount++;this.chars.busy=true;if(this.quizCount>1)this.owner.qzdiv.innerHTML=this.owner.createQuiz();this.chars.stopAll();this.chars.c[0].char.Balloon.Style|=15;this.chars.c[0].show();this.chars.c[0].play("Wave");this.chars.c[0].play("RestPose");this.req1=this.chars.c[0].speak(lfns.introducePage(this.title)+this.msg);this.status=1;this.updateBtn();};WritingQuiz.prototype.check=function(){if(!this.finished())return;this.chars.busy=true;var ok=0;for(i=0;i<this.itemNo;i++){if(this.answers[i].equals(this.keys[i],this.uopt))ok++;else{eval("this.owner.item"+i+".style.color = \"red\"");eval("this.owner.item"+i+".value += \" (\" + this.keys[i] + \")\"");}}this.chars.clearTimer();this.chars.c[0].stopAll();this.chars.c[0].char.Balloon.Style|=15;this.chars.c[0].actGrade(ok,this.itemNo);this.req3=this.chars.c[0].speak(lfns.sayGrade(ok,this.itemNo));this.chars.c[0].play("RestPose");this.status=0;this.itemNo=0;};WritingQuiz.prototype.finished=function(){var n=0;var gcOk=true;for(i=0;i<this.itemNo;i++){if(eval("this.owner.item"+i+".value.trim().length")>0){this.answers[i]=new Utterance(eval("this.owner.item"+i+".value"),this.utype);if(this.uopt.indexOf("dc")<0){this.answers[i].check();if(this.answers[i].status>1){gcOk=false;break;}}n++;}}if(n==this.itemNo){return true;}else if(gcOk){this.chars.busy=true;this.chars.c[0].stopAll();this.chars.c[0].play("Decline");this.req2=this.chars.c[0].speak("Please complete all the items before checking your answers.");return false;}};WritingQuiz.prototype.requestComplete=function(request){switch(request){case this.req1:this.chars.c[0].char.Balloon.Style&=this.balloonStyle;this.chars.busy=false;this.updateBtn();this.chars.setTimer("this.chars.c[0].actIdle()",20000);break;case this.req2:this.chars.busy=false;break;case this.req3:this.chars.busy=false;this.updateBtn();this.chars.wnd.setTimeout("this.chars.c[0].actIdle()",10000);break;}};WritingQuiz.prototype.btnClick=function(){if(this.chars.busy)return;if(this.status==1){this.check();}else this.start();};WritingQuiz.prototype.updateBtn=function(){this.owner.qzbtn.style.visibility="visible";if(this.status==1){this.owner.qzimg.src=rootDir+"images/check.gif";this.owner.qzimg.alt="Press to check your answers"}else{this.owner.qzimg.src=rootDir+"images/start.gif";this.owner.qzimg.alt="Press to start a new quiz"}};WritingQuiz.prototype.talk=function(text){if(this.chars.busy)return;this.chars.busy=true;this.chars.c[0].char.Balloon.Style&=this.balloonStyle;this.chars.c[0].stopAll();var r=Math.floor(Math.random()*9);switch(r){case 0:this.chars.c[0].play("Announce");break;case 1:this.chars.c[0].play("Explain");break;case 2:this.chars.c[0].play("Think");break;}this.req2=this.chars.c[0].speak(this.charSpeed+text);this.chars.c[0].play("RestPose");};function GuessingGame(owner,chars,title,msg,maxQn){this.owner=owner;this.chars=chars;this.title=title;this.msg=msg;this.maxQn=maxQn;this.utype=0;this.uopt="";if(arguments.length>5)this.utype=arguments[5];if(arguments.length>6)this.uopt=arguments[6];this.questions=new Array();this.guesses=new Array();this.answers=new Array();this.keyNumber=0;this.gameCount=0;this.questionCount=0;this.status=0;this.clearBox=false;this.req1=null;this.req2=null;this.req3=null;this.imgSlideCount=0;this.imgSlideTimer=null;this.chars.requestCompleteOwner=this;this.balloonStyle=15;}GuessingGame.prototype.start=function(){this.gameCount++;this.status=1;this.questionCount=0;this.chars.busy=true;if(this.gameCount>1)this.owner.gmdiv.innerHTML=this.owner.createGame();this.owner.gmimg2.style.visibility="hidden";if(typeof this.owner.gmimg3=="object")this.owner.gmimg3.style.visibility="visible";this.chars.stopAll();this.chars.c[0].char.Balloon.Style|=15;this.chars.c[0].show();this.chars.c[0].play("Wave");this.chars.c[0].play("RestPose");this.req1=this.chars.c[0].speak(lfns.introducePage(this.title)+this.msg);this.updateBtn1();};GuessingGame.prototype.btn2Click=function(){if(this.status!=1)return;if(this.chars.busy)return;this.chars.busy=true;var ut=new Utterance(this.owner.gmbox.value,this.utype);if(ut.text.length==0){this.chars.c[0].play("Decline");this.req2=this.chars.c[0].speak("First type your question or guess into the box, and then press the button.");return;}if(this.uopt.indexOf("dc")<0){ut.check();if(ut.status>1){this.chars.busy=false;return;}}for(var i=0;i<this.guesses.length;i++){if(ut.equals(this.guesses[i],this.uopt)){this.processGuess(i);return;}}for(var i=0;i<this.questions.length;i++){if(ut.equals(this.questions[i],this.uopt)){this.processQuestion(ut,i);return;}}this.chars.c[0].play("Decline");this.req2=this.chars.c[0].speak("I'm sorry, I don't understand. Please check that the sentence is built from the tables below.");};GuessingGame.prototype.processGuess=function(gn){this.chars.c[0].char.Balloon.Style|=15;if(this.keyNumber==gn){this.chars.c[0].play("Congratulate");this.req3=this.chars.c[0].speak(lfns.congratulate()+"You've guessed it right.");}else{this.chars.c[0].play("Sad");this.req3=this.chars.c[0].speak(lfns.showSympathy()+"your guess was wrong. Better luck next time.");}this.chars.c[0].play("RestPose");this.clearTimer();if(typeof this.owner.gmimg3=="object"){this.owner.gmimg3.style.visibility="hidden";}else{var i=0;while(eval("typeof this.owner.gmimg3"+i+" == \"object\"")){eval("this.owner.gmimg3"+i+".style.visibility = \"hidden\"");i++;}}this.owner.gmimg2.style.visibility="visible";};GuessingGame.prototype.processQuestion=function(ut,qn){this.questionCount++;this.clearBox=true;if(this.questionCount>this.maxQn){this.chars.c[0].play("Decline");this.req2=this.chars.c[0].speak("No more questions, please. Make your \\Emp\\guess.");}else{if(typeof this.owner.processQuestion=="function"){var ans=new Array();this.owner.processQuestion(ut,qn,ans);this.chars.c[0].play(ans[0]);this.req2=this.chars.c[0].speak(ans[1]);}else{if(this.answers[qn]==0)this.chars.c[0].play("Decline");else this.chars.c[0].play("Acknowledge");this.req2=this.chars.c[0].speak(ut.answerYesNo2(this.answers[qn]));}}};GuessingGame.prototype.requestComplete=function(request){switch(request){case this.req1:this.chars.c[0].char.Balloon.Style&=this.balloonStyle;this.chars.busy=false;this.updateBtn1();break;case this.req2:if(this.clearBox)this.owner.gmbox.value="";this.clearBox=false;this.owner.gmbox.focus();this.chars.busy=false;break;case this.req3:this.chars.busy=false;this.status=0;this.updateBtn1();this.chars.wnd.setTimeout("this.chars.c[0].actIdle()",10000);break;}};GuessingGame.prototype.btn1Click=function(){if(this.status>0){if(!confirm("Are you sure you want to stop the game?"))return;this.status=0;this.chars.c[0].stopAll();this.clearTimer();}else{this.start();}this.updateBtn1();};GuessingGame.prototype.updateBtn1=function(){this.owner.gmbtn1.style.visibility="visible";if(this.status>0){this.owner.gmimg1.src=rootDir+"images/stop.gif";this.owner.gmimg1.alt="Press to stop the game"}else{this.owner.gmimg1.src=rootDir+"images/start.gif";this.owner.gmimg1.alt="Press to start a new game"}};GuessingGame.prototype.clearTimer=function(){if(this.imgSlideTimer!=null){this.owner.clearInterval(this.imgSlideTimer);this.imgSlideTimer=null;}};function TechInfo(){this.dialog=null;this.lang=0;this.subject=new Array(2);this.msg=new Array(2);this.charId="";this.dialogIsOpen=false;this.dialogModal=false;this.layer=null;this.wnd=null;this.lmsg="";this.subject[0]="";this.subject[1]="";this.msg[0]="";this.msg[1]="";this.COMPONENT_NOT_FOUND=1;this.URL_CHAR_LOAD_FAILED=2;this.UNC_CHAR_LOAD_FAILED=3;this.GET_ERROR=4;this.TTS_MODE_ERROR=5;this.CHAR_DOWNLOAD_PAGE="<a href=\"http://www.microsoft.com/msagent/downloads.htm#character\" target=\"_blank\">Microsoft Agent Downloads</a>";}TechInfo.prototype.openPage=function(){var url="";if(this.dialogModal)url=rootDir;if(arguments.length>0)url+=arguments[0];else url+=(this.lang==0)? "tech_info.html":"tech_info_gl.html";window.open(url,"_blank","width=560,height=360,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,top=80,left=80,resizable=yes");};TechInfo.prototype.openDialog=function(dialogNumber,modal){if(arguments.length>2)this.charId=arguments[2];this.setDialogText(dialogNumber);this.lang=0;var url=rootDir+"tech_dia.html";var args="dialogWidth: 450px; dialogHeight: 300px; center: Yes; help: No; status: No;";if(!this.dialogIsOpen){this.dialogIsOpen=true;this.dialogModal=modal;if(modal)window.showModalDialog(url,this,args);else window.showModelessDialog(url,this,args);}else{this.writeDialog();}};TechInfo.prototype.closeDialog=function(){if(this.dialog==null)return;if(this.dialog.closed)return;this.dialog.close();this.dialogIsOpen=false;};TechInfo.prototype.writeDialog=function(){if(this.dialog==null)return;if(typeof this.dialog.subject!="object")return;this.dialog.subject.innerHTML=this.subject[this.lang];this.dialog.msg.innerHTML=this.msg[this.lang];if(this.lang==0){this.dialog.flag.src="images/galician_flag.gif";this.dialog.flag.alt="Galician version";this.dialog.closeimg.alt="OK";this.dialog.helpimg.alt="More information";}else{this.dialog.flag.src="images/british_flag.gif";this.dialog.flag.alt="Versión inglesa";this.dialog.closeimg.alt="Aceptar";this.dialog.helpimg.alt="Máis información";}};TechInfo.prototype.translateDialog=function(){this.lang=(this.lang+1)%2;this.writeDialog();};TechInfo.prototype.setDialogText=function(dialogNumber){switch(dialogNumber){case this.COMPONENT_NOT_FOUND:this.subject[0]="Downloading software components";this.subject[1]="Descargando compoñentes de software";this.msg[0]="In order to use Microsoft Agent characters, the <cite>On-line English Workbook</cite> needs to download up to three components and/or speech engines from Microsoft's web site. You should install each one after download. Please be patient: the whole process could take a while but you will only need to do it once. Look at the status bar for information about the components being downloaded.";this.msg[1]="Para usar os personaxes de Microsoft Agent, <cite>On-line English Workbook</cite> necesita descargar ata tres compoñentes e/ou motores de voz desde sitio web de Microsoft. Deberás instalar cada un despois da súa descarga. Por favor ten paciencia: o proceso completo pode levar un rato pero só será necesario facelo unha vez. Mira a barra de estado para informarte dos compoñentes que se están descargando.";break;case this.URL_CHAR_LOAD_FAILED:this.subject[0]="Unable to load the character's data from Microsoft's web site";this.subject[1]="Non se puideron cargar os datos do personaxe desde o sitio web de Microsoft";this.msg[0]="If the problem persists, you may need to download "+this.charId+"'s file from "+this.CHAR_DOWNLOAD_PAGE+" and install it on your computer.";this.msg[1]="Se continúa o problema, proba a descargar o ficheiro de "+this.charId+" desde "+this.CHAR_DOWNLOAD_PAGE+" e instalalo no teu ordenador.";break;case this.UNC_CHAR_LOAD_FAILED:this.subject[0]="Unable to load the character's data from your computer";this.subject[1]="Non se puideron cargar os datos do personaxe desde o teu ordenador";this.msg[0]="If the problem persists, you may need to reinstall "+this.charId+"'s file.";this.msg[1]="Se continúa o problema, proba a reinstalar o ficheiro de "+this.charId+".";break;case this.GET_ERROR:this.subject[0]="Animation load error";this.subject[1]="Erro na carga da animación";this.msg[0]="There has been an error while loading an animation for "+this.charId+" from Microsoft's web site. If the problem persists, you may need to download "+this.charId+"'s file from "+this.CHAR_DOWNLOAD_PAGE+" and install it on your computer.";this.msg[1]="Produciuse un erro durante a carga dunha animación de "+this.charId+" desde o sitio web de Microsoft. Se continúa o problema, proba a descargar o ficheiro de "+this.charId+" desde "+this.CHAR_DOWNLOAD_PAGE+" e instalalo no teu ordenador.";break;case this.TTS_MODE_ERROR:this.subject[0]="Text-to-speech engine error";this.subject[1]="Erro do motor de voz";this.msg[0]="Check that you are not browsing the page off line or that "+this.charId+"'s data file is installed on your computer.";this.msg[1]="Comproba que non estás navegando sen conexión ou que o ficheiro de datos de "+this.charId+" está instalado no teu ordenador.";break;}};TechInfo.prototype.showMessage=function(msg){this.lmsg=msg;this.layer=null;this.wnd=null;if(typeof window.tmsgdiv=="object"){this.layer=window.tmsgdiv;this.wnd=window;}else if(typeof window.myframe=="object"){if(typeof window.myframe.tmsgdiv=="object"){this.layer=window.myframe.tmsgdiv;this.wnd=window.myframe;}}else{alert(this.lmsg);return;}this.layer.innerHTML="<p style=\"padding: .5em 1em; color: inherit; background: inherit; text-align: center;\">"+this.lmsg+"</p>";var bwidth=this.wnd.document.body.clientWidth;var bheight=this.wnd.document.body.clientHeight;var mwidth=300;var mheight=20;with(this.layer.style){left=(bwidth-mwidth)/2 + this.wnd.document.body.scrollLeft;top=(bheight-mheight)/2 + this.wnd.document.body.scrollTop;width=mwidth;height=mheight;}window.setTimeout("if (tinfo.layer != null) if (tinfo.layer != null) tinfo.layer.style.visibility = \"visible\"",500);};TechInfo.prototype.closeMessage=function(){if(this.layer==null)return;this.layer.style.visibility="hidden";this.layer=null;};function MsaChars(){this.c=new Array();this.startPageOwner=null;this.requestCompleteOwner=null;this.wnd=window;this.timer=null;this.busy=true;this.getBusy=false;}MsaChars.prototype.load=function(){if(this.c.length==0){window.setTimeout("chars.load()",500);}else{this.c[0].load();}};MsaChars.prototype.startPage=function(){if(this.startPageOwner==null)return;if(this.c.length==0)return;if(this.maxStatus()>2)return;this.startPageOwner.start();};MsaChars.prototype.maxStatus=function(){var status=0;for(var i=0;i<this.c.length;i++)status=Math.max(status,this.c[i].status);return status;};MsaChars.prototype.getCharIndex=function(charId){var i;for(i=0;i<this.c.length;i++)if(this.c[i].id==charId)break;if(i<this.c.length){return i;}else{return 0;}};MsaChars.prototype.stopAll=function(){this.clearTimer();for(i=0;i<this.c.length;i++)if(this.c[i].status<3)this.c[i].stopAll();};MsaChars.prototype.checkClick=function(w){if(this.getBusy)w.event.returnValue=false;};MsaChars.prototype.checkBeforeUnload=function(w){if(this.getBusy){w.event.returnValue="Do not leave this page while Microsoft Agent is loading an animation. Your browser might hang. CHOOSE \"CANCEL\".\n\nNon salgas desta páxina mentres Microsoft Agent está cargando unha animación. O navegador podería quedarse colgado. ESCOLLE \"CANCELAR\".";}};MsaChars.prototype.setTimer=function(fn,tm){if(this.timer==null)this.timer=this.wnd.setInterval(fn,tm);};MsaChars.prototype.clearTimer=function(){if(this.timer!=null)this.wnd.clearInterval(this.timer);this.timer=null;};function MsaChar(){this.id=arguments[0];this.gender=arguments[1];this.x=0;this.y=0;this.width=160;this.height=170;switch(arguments[2]){case "nw":this.x=0;this.y=0;break;case "n":this.x=(screen.width-this.width)/ 2;this.y=0;break;case "ne":this.x=screen.width-this.width;this.y=0;break;case "w":this.x=0;this.y=(screen.height-this.height)/ 2;break;case "c":this.x=(screen.width-this.width)/ 2;this.y=(screen.height-this.height)/ 2;break;case "e":this.x=screen.width-this.width;this.y=(screen.height-this.height)/ 2;break;case "sw":this.x=0;this.y=screen.height-this.height;break;case "s":this.x=(screen.width-this.width)/ 2;this.y=screen.height-this.height;break;case "se":this.x=screen.width-this.width;this.y=screen.height-this.height;break;}this.tx=new Array();for(var i=3;i<arguments.length;i++)this.tx[i-3]=arguments[i];this.char=null;this.status=6;this.loadUncReq=null;this.loadUrlReq=null;this.show1Req=null;this.greet1Req=null;this.getReq=new Array();for(var i=0;i<10;i++)this.getReq[i]=null;this.animName=new Array();for(var i=0;i<10;i++)this.animName[i]="";this.getI=0;this.protocol="unc";this.speed="\\Spd=150\\";switch(this.id){case "Peedy":this.unc="peedy.acs";this.url="http://agent.microsoft.com//agent2//chars//peedy//peedy.acf";this.pitch="\\Pit=104\\";break;case "Merlin":this.unc="merlin.acs";this.url="http://agent.microsoft.com//agent2//chars//merlin//merlin.acf";this.pitch="\\Pit=98\\";break;case "Genie":this.unc="genie.acs";this.url="http://agent.microsoft.com//agent2//chars//genie//genie.acf";this.pitch="\\Pit=92\\";break;case "Robby":this.unc="robby.acs";this.url="http://agent.microsoft.com//agent2//chars//robby//robby.acf";this.pitch="\\Pit=87\\";break;}}MsaChar.prototype.load=function(){if(this.status<=4)return;agent.Connected=true;try{this.loadUncReq=agent.Characters.Load(this.id,this.unc);}catch(e){this.loadUrlReq=agent.Characters.Load(this.id,this.url);this.protocol="url";}};MsaChar.prototype.show1=function(){this.char=agent.Characters.Character(this.id);this.char.Balloon.Style|=15;this.char.LanguageID=0x0809;try{if(this.gender=="male"){this.char.TTSModeID="{227A0E41-A92A-11d1-B17B-0020AFED142E}";}else{this.char.TTSModeID="{227A0E40-A92A-11d1-B17B-0020AFED142E}";}}catch(e){tinfo.openDialog(tinfo.TTS_MODE_ERROR,false,this.id);return;}this.moveTo(this.x,this.y);this.get("State","Hiding");this.show1Req=this.show();};MsaChar.prototype.greet1=function(){this.play("Greet");var text;for(var i=0;i<this.tx.length;i++){text=this.tx[i];switch(text){case "[greet]":text=lfns.greet();break;case "[name]":text=lfns.sayName(this.id);break;case "[greet+name]":text=lfns.greet()+lfns.sayName(this.id);break;}this.speak(text);if(this.tx.length>1)this.play("RestPose");}this.greet1Req=this.play("RestPose");};MsaChar.prototype.get=function(type,name){if(this.protocol=="unc")return;this.getI=(this.getI+1)%10;this.animName[this.getI]=name;try{this.getReq[this.getI]=this.char.Get(type,name);}catch(e){tinfo.openDialog(tinfo.GET_ERROR,false,this.id);}};MsaChar.prototype.play=function(animationName){if(this.protocol=="url"){var aList=animationName;switch(animationName){case "Greet":aList+=", GreetReturn";break;case "Announce":aList+=", AnnounceReturn";break;case "Confused":aList+=", ConfusedReturn";break;case "Congratulate":aList+=", CongratulateReturn";break;case "Decline":aList+=", DeclineReturn";break;case "Explain":aList+=", ExplainReturn";break;case "Pleased":aList+=", PleasedReturn";break;case "Sad":aList+=", SadReturn";break;case "Suggest":aList+=", SuggestReturn";break;case "Surprised":aList+=", SurprisedReturn";break;case "Think":aList+=", ThinkReturn";break;case "Uncertain":aList+=", UncertainReturn";break;case "Wave":aList+=", WaveReturn";break;case "Idle2_1":if(this.id.toLowerCase()=="peedy")aList+=", Idle2_1Return";break;case "Idle2_2":if(this.id.toLowerCase()=="genie")aList+=", Idle2_2Return";break;case "Idle3_2":if(this.id.toLowerCase()=="peedy"||this.id.toLowerCase()=="genie"||this.id.toLowerCase()=="merlin")aList+=", Idle3_2Return";break;}this.get("Animation",aList);}return this.char.Play(animationName);};MsaChar.prototype.show=function(){this.get("State","Showing");return this.char.Show();};MsaChar.prototype.moveTo=function(x,y){if(this.protocol=="url"&&this.char.Visible)this.get("State","Moving");return this.char.MoveTo(x,y);};MsaChar.prototype.speak=function(text){this.get("State","Speaking");var s=text.trim();s=s.replace(/spell\[(.+?)\]/i,"&spell&");var spell1=RegExp.$1;var spell2="";for(var i=0;i<spell1.length;i++){spell2+=spell1.charAt(i).toUpperCase();if(i+1<spell1.length){spell2+=", ";}else{spell2+=".";}}var s1=s;var s2=s;if(s1.search(/#.*~.*#/)>=0){s1=s1.replace(/~(.*)#/g,"");s1=s1.replace(/(#|~)/g,"");s2=s2.replace(/#(.*)~/g,"");s2=s2.replace(/(#|~)/g,"");}else{s2="";}s1=s1.replace(/&spell&/i,"\\Pau=600\\\\Spd=60\\"+spell2+this.speed);s1=this.speed+this.pitch+s1;s2=s2.replace(/&spell&/i,spell2);if(s2.length>0){s="\\Map=\""+s1+"\"=\""+s2+"\"\\";}else{s=s1;}return this.char.Speak(s);};MsaChar.prototype.stopAll=function(){this.char.StopAll("Move");this.char.StopAll("Play");this.char.StopAll("Speak");this.play("RestPose");};MsaChar.prototype.actGrade=function(ok,n){var grade=Math.round(100*ok/n);this.play("Process");if(grade>=90){return this.play("Congratulate");}else if(grade>=60){return this.play("Pleased");}else if(grade>=20){return this.play("Sad");}else{this.play("Confused");return this.play("Sad");}};MsaChar.prototype.actIdle=function(){if(typeof chars=="undefined")return;if(chars.busy)return;this.stopAll();switch(Math.floor(Math.random()*4)){case 0:this.play("Idle2_1");break;case 1:this.play("Idle2_2");break;case 2:this.play("Idle3_1");break;case 3:this.play("Idle3_2");break;}};function agentRequestComplete(request){for(var i=0;i<chars.c.length;i++){switch(request){case chars.c[i].loadUncReq:if(request.Status==0){chars.c[i].status=4;chars.c[i].show1();}else{chars.c[i].status=5;tinfo.openDialog(tinfo.UNC_CHAR_LOAD_FAILED,false,chars.c[i].id);}return;case chars.c[i].loadUrlReq:chars.getBusy=false;tinfo.closeMessage();if(request.Status==0){chars.c[i].status=4;chars.c[i].show1();}else{chars.c[i].status=5;tinfo.openDialog(tinfo.URL_CHAR_LOAD_FAILED,false,chars.c[i].id);}return;}}for(var i=0;i<chars.c.length;i++){if(request==chars.c[i].show1Req){if(request.Status==0){chars.c[i].status=2;chars.c[i].greet1();}else{chars.c[i].status=3;alert("Unable to show "+chars.c[i].id);}return;}}for(var i=0;i<chars.c.length;i++){if(request==chars.c[i].greet1Req){if(request.Status==0){chars.c[i].status=0;if(i+1<chars.c.length)chars.c[i+1].load();else chars.startPage();}else{chars.c[i].status=1;}return;}}for(var i=0;i<chars.c.length;i++){for(var j=0;j<10;j++){if(request==chars.c[i].getReq[j]){chars.getBusy=false;tinfo.closeMessage();return;}}}if(chars.requestCompleteOwner!=null)chars.requestCompleteOwner.requestComplete(request);}function agentRequestStart(request){for(var i=0;i<chars.c.length;i++){if(request==chars.c[i].loadUrlReq){chars.getBusy=true;tinfo.showMessage("Loading "+chars.c[i].id+"'s data from Microsoft's web site");return;}for(var j=0;j<10;j++){if(request==chars.c[i].getReq[j]){chars.getBusy=true;tinfo.showMessage("Loading animation for "+chars.c[i].id+": "+chars.c[i].animName[j]);return;}}}}function agentClick(CharacterID,Button,Shift,X,Y){if(chars.maxStatus()>1)return;if(chars.busy||chars.getBusy)return;var d=chars.c[chars.getCharIndex(CharacterID)];chars.stopAll();d.play("Alert");var s="";switch(Math.floor(Math.random()*2)){case 0:s="Hey, watch it with that pointer!";break;case 1:s="Oh that tickles!";break;}d.speak(s);d.play("Blink");}function agentDragComplete(CharacterID,Button,Shift,X,Y){if(chars.maxStatus()>1)return;if(chars.busy||chars.getBusy)return;var d=chars.c[chars.getCharIndex(CharacterID)];chars.stopAll();d.play("Blink");var s="";switch(Math.floor(Math.random()*4)){case 0:s="Well, \\emp\\this gives me a new perspective!";break;case 1:s="I like it much better over here.";break;case 2:s="Now why did you move me?";break;case 3:s="Hey, be careful!";break;}d.speak(s);d.play("Blink");}String.prototype.trim=s_trim;function s_trim(){return this.replace(/(^\s*)|(\s*$)/g,"");}String.prototype.xtrim=s_xtrim;function s_xtrim(){return this.trim().replace(/( {2,})/g," ");}String.prototype.removePunctuation=s_removePunctuation;function s_removePunctuation(){return this.replace(/([,;:\.\?!"])/g,"");}String.prototype.toFirstUpperCase=s_toFirstUpperCase;function s_toFirstUpperCase(){return this.replace(/^(\w)/i,function(fl){return fl.toUpperCase();});}String.prototype.addArticle=s_addArticle;function s_addArticle(){if(this.search(/^(?:university|uniform)/i)==0)return "a "+this;if(this.search(/^(?:a|e|i|o|u|hour)/i)==0)return "an "+this;else return "a "+this;}String.prototype.addNumber=s_addNumber;function s_addNumber(number){var s=number+" ";if(number==1)return s+this;else return s+lforms.getPlural(this);}String.prototype.addNegativeContraction=s_addNegativeContraction;function s_addNegativeContraction(){var s=this;s=this.replace(/\b(are|is|was|were|have|has|had|do|does|did|could|might|should|would|must|ought|need)\b/g,"$1n't");if(s!=this)return s;s=this.replace(/\b(can)\b/g,"can't");if(s!=this)return s;s=this.replace(/\b(will)\b/g,"won't");if(s!=this)return s;s=this.replace(/\b(shall)\b/g,"shan't");if(s!=this)return s;else return this+" not";}function GrammarRules(){this.SENTENCE=1;this.SENTENCE_DECLARATIVE=2;this.QUESTION=4;this.IRREG_PAST_PART="been|become|begun|bitten|blown|broken|brought|built|burnt|bought|caught|chosen|come|cost|cut|done|drawn|dreamt|drunk|driven|eaten|fallen|felt|fought|found|flown|forgotten|got|given|gone|grown|hung|had|heard|hit|held|hurt|kept|known|led|learnt|left|lent|lain|lost|made|meant|met|paid|put|read|ridden|rung|risen|run|said|seen|sold|sent|shown|shut|sung|sat|slept|spoken|spelt|spent|stood|stolen|swum|taken|taught|torn|told|thought|thrown|understood|woken|worn|won|written";}GrammarRules.prototype.test=function(u){var i=0;while(u.status==0){try{eval("this.gmrule"+i+"(u)");}catch(e){break;}i++;}};GrammarRules.prototype.gmrule0=function(u){if(u.text.search(/\b(?:(I|you|he|she|it|we|they)('d))(?=( (not|never))? (become|bid|burst|cast|come|cost|cut|hit|hurt|let|put|read|run|set|shut|split|spread))/i)>=0){u.status=2;u.gcSubject[0]="Ambiguity";u.gcMsg[0]="I cannot decide whether the short form <em>'d</em> stands for <em>had</em> or <em>would</em> in the following text:";u.gcNotes[0]="Please write the full form and try again.";u.gcSubject[1]="Ambigüidade";u.gcMsg[1]="Non podo decidir se a forma <em>'d</em> é unha contracción de <em>had</em> ou de <em>would</em> no texto seguinte:";u.gcNotes[1]="Escribe a forma plena e inténtao de novo.";}};GrammarRules.prototype.gmrule1=function(u){var re;var notes0;var notes1;if((u.type&this.QUESTION)>0){re=/^[A-Z].*\?$/;notes0="Questions must start with a <em>capital letter</em> and end with a <em>question mark</em>.";notes1="As preguntas deben comezar cunha <em>letra maiúscula</em> e rematar cun <em>signo de interrogación</em>.";}else if((u.type&this.SENTENCE_DECLARATIVE)>0){re=/^[A-Z].*\.$/;notes0="Declarative sentences must start with a <em>capital letter</em> and end with a <em>full stop</em>.";notes1="As oracións declarativas deben comezar cunha <em>letra maiúscula</em> e rematar cun <em>punto</em>.";}else if((u.type&this.SENTENCE)>0){re=/^[A-Z].*[\?\.!]$/;notes0="Sentences must start with a <em>capital letter</em> and end with a <em>full stop</em>, a <em>question mark</em> or an <em>exclamation mark</em>.";notes1="As oracións deben comezar cunha <em>letra maiúscula</em> e rematar cun <em>punto</em>, un <em>signo de interrogación</em> ou un <em>signo de exclamación</em>.";}else{return;}if(u.text.search(re)<0){u.status=2;u.gcSubject[0]="Punctuation";u.gcNotes[0]=notes0;u.gcSubject[1]="Puntuación";u.gcNotes[1]=notes1;}};GrammarRules.prototype.gmrule2=function(u){if(u.text.search(/\ba \b(?:a|e|i|o|u|hour)(?!niform|nivers)/i)>=0||u.text.search(/\ban \b(?:[^aeiou]|uniform|univers)/i)>=0){u.status=2;u.gcSubject[0]="Use of <em>a/an</em>";u.gcNotes[0]="Use <em>a</em> before words beginning with consonant sounds; use <em>an</em> before words beginning with vowel sounds.";u.gcSubject[1]="Uso de <em>a/an</em>";u.gcNotes[1]="Usa <em>a</em> diante de palabras que comecen por son consoante; usa <em>an</em> diante de palabras que comecen por son vocal.";}};function Utterance(text){this.text=text.xtrim();this.type=0;if(arguments.length>=2)this.type=arguments[1];this.status=0;this.xtext="";this.gcLang=0;this.gcSubject=new Array(2);this.gcMsg=new Array(2);this.gcNotes=new Array(2);this.gcSubject[0]="";this.gcMsg[0]="The following text is incorrect:";this.gcNotes[0]="";this.gcSubject[1]="";this.gcMsg[1]="O texto seguinte é incorrecto:";this.gcNotes[1]="";this.grls=null;if(typeof grls=="object")this.grls=grls;else if(typeof parent.grls=="object")this.grls=parent.grls;}Utterance.prototype.check=function(){if(this.status>0)return;this.grls.test(this);if(this.status>1){var url=rootDir+"gcheck_dia.html";window.showModalDialog(url,this,"dialogHeight: 320px; dialogWidth: 480px; center: Yes; help: No; status: No;");}this.status++;};Utterance.prototype.writeGrammarCheckPage=function(w){w.subject.innerHTML=this.gcSubject[this.gcLang];w.msg.innerHTML=this.gcMsg[this.gcLang];w.text.innerHTML=this.text;w.notes.innerHTML="<img src=\"images/lightbulb.gif\" width=\"21\" height=\"30\" />"+this.gcNotes[this.gcLang];if(this.gcLang==0){w.flag.src="images/galician_flag.gif";w.flag.alt="Galician version";}else{w.flag.src="images/british_flag.gif";w.flag.alt="English version";}this.gcLang=(this.gcLang+1)%2;};Utterance.prototype.expand=function(){if(this.status==0)this.check();if(this.status>1)return;if(this.xtext.length>0)return;var re;var s=this.text;s=s.replace(/\b(won't)\b/g,"will not");s=s.replace(/\b(can't)\b/g,"cannot");s=s.replace(/\b(can not)\b/g,"cannot");s=s.replace(/\b(shan't)\b/g,"shall not");s=s.replace(/(n't)/g," not");re=new RegExp("\\b(he|she|it|there)('s)(?=( (not|never))? (\\w+ed|"+grls.IRREG_PAST_PART+"))","gi");s=s.replace(re,"$1 has");re=new RegExp("\\b(I|you|he|she|it|we|they)('d)(?=( (not|never))? (\\w+ed|better|"+grls.IRREG_PAST_PART+"))","gi");s=s.replace(re,"$1 had");s=s.replace(/\b(I'm)\b/gi,"I am");s=s.replace(/\b(you|we|they)('re)\b/gi,"$1 are");s=s.replace(/\b(he|she|it|there)('s)\b/gi,"$1 is");s=s.replace(/\b(I|you|we|they)('ve)\b/gi,"$1 have");s=s.replace(/\b(I|you|he|she|it|we|they)('ll)\b/gi,"$1 will");s=s.replace(/\b(I|you|he|she|it|we|they)('d)\b/gi,"$1 would");this.xtext=s;};Utterance.prototype.equals=function(key){var s1=this.text;var s2=key;var options="";if(arguments.length>1)options=arguments[1];if(options.indexOf("dc")<0){this.check();if(this.status>1)return false;if(options.indexOf("dx")<0){this.expand();s1=this.xtext;}}if(options.indexOf("mc")<0){s1=s1.toLowerCase();s2=s2.toLowerCase();}if(options.indexOf("mp")<0){s1=s1.removePunctuation();s2=s2.removePunctuation();}return(s1==s2);};Utterance.prototype.answerYesNo=function(answer){if(this.text.search(/^(am|are|is|was|were|have|has|had|do|does|did|can|could|may|might|shall|should|will|would|must|need)\b +\b(I|you|he|she|it|we|they)\b/i)<0)return "";var verb=RegExp.$1.toLowerCase();var subj=RegExp.$2.toLowerCase();switch(subj){case "i":subj="you";if(verb=="am")verb="are";else if(verb=="was")verb="were";break;case "we":subj="you";break;case "you":subj="i";if(verb=="are")verb="am";else if(verb=="were")verb="was";break;}if(subj=="i")subj="I";if(answer==1)return "Yes, "+subj+" "+verb+". ";else return "No, "+subj+" "+verb.addNegativeContraction()+". ";};Utterance.prototype.answerYesNo2=function(answer){var ans=this.answerYesNo(answer);return "#"+ans.removePunctuation()+".~"+ans+"#";};function LanguageForms(){this.irregVbBaseStr="beat become begin bend bind bite bleed blow break bring build burn burst buy catch choose come cost cut deal dig do draw dream drink drive eat fall feed feel fight find fly forbid forget freeze get give go grow hang have hear hide hit hold hurt keep know lay lead lean learn leave lend let lie light lose make mean meet pay put read ride ring rise run say see seek sell send set shake shine shoot show shut sing sit sleep smell speak spell spend split spread stand steal stick strike swear sweep swell swim take teach tear tell think throw understand wake wear weep win wind write";this.irregVbPastStr="beat became began bent bound bit bled blew broke brought built burnt burst bought caught chose came cost cut dealt dug did drew dreamt drank drove ate fell fed felt fought found flew forbade forgot froze got gave went grew hung had heard hid hit held hurt kept knew laid led leant learnt left lent let lay lit lost made meant met paid put read rode rang rose ran said saw sought sold sent set shook shone shot showed shut sang sat slept smelt spoke spelt spent split spread stood stole stuck struck swore swept swelled swam took taught tore told thought threw understood woke wore wept won wound wrote";this.irregVbPartStr="beaten become begun bent bound bitten bled blown broken brought built burnt burst bought caught chosen come cost cut dealt dug done drawn dreamt drunk driven eaten fallen fed felt fought found flown forbidden forgotten frozen got given gone grown hung had heard hidden hit held hurt kept known laid led leant learnt left lent let lain lit lost made meant met paid put read ridden rung risen run said seen sought sold sent set shaken shone shot shown shut sung sat slept smelt spoken spelt spent split spread stood stolen stuck struck sworn swept swollen swum taken taught torn told thought thrown understood woken worn wept won wound written";this.irregVbBase=this.irregVbBaseStr.split(" ");this.irregVbPast=this.irregVbPastStr.split(" ");this.irregVbPart=this.irregVbPartStr.split(" ");}LanguageForms.prototype.getSForm=function(base){var s=base;s=s.replace(/(quiz)$/i,"$1z");s=s.replace(/([^aeiou])(y)$/i,"$1ie");s=s.replace(/(s|z|sh|ch|do|go)$/i,"$1e");s=s.replace(/(have)$/i,"ha");return s+"s";};LanguageForms.prototype.getPastForm=function(base){var idx=this.getIrregVbIndex(base);if(idx>-1){return this.irregVbPast[idx];}else{return this.getEdForm(base);}};LanguageForms.prototype.getPartForm=function(base){var idx=this.getIrregVbIndex(base);if(idx>-1){return this.irregVbPart[idx];}else{return this.getEdForm(base);}};LanguageForms.prototype.getEdForm=function(base){var s=base;s=this.doubleFinalConsonant(s);s=s.replace(/([^aeiou])(y)$/i,"$1i");s=s.replace(/(e)$/i,"");return s+"ed";};LanguageForms.prototype.getIngForm=function(base){var s=base;s=this.doubleFinalConsonant(s);s=s.replace(/(ie)$/i,"y");if(s.toLowerCase()!="singe"){s=s.replace(/([^eyo])(e)$/i,"$1");}return s+"ing";};LanguageForms.prototype.getPlural=function(base){var s=base;s=s.replace(/(quiz)$/i,"$1z");s=s.replace(/([^aeiou])(y)$/i,"$1ie");s=s.replace(/(s|z|sh|ch|tomato|potato)$/i,"$1e");return s+"s";};LanguageForms.prototype.doubleFinalConsonant=function(base){var s=base;s=s.replace(/([^aeiou])([aeiou])([^aeiouyw])$/i,function(sub,cap1,cap2,cap3,offset,s){if("enter visit develop envelop gallop gossip".indexOf(s.toLowerCase())>-1){return cap1+cap2+cap3;}else if(cap3=="c"){return cap1+cap2+cap3+"k";}else{return cap1+cap2+cap3+cap3;}});return s;};LanguageForms.prototype.getIrregVbIndex=function(base){var idx=-1;for(var i=0;i<this.irregVbBase.length;i++){if(this.irregVbBase[i]==base.toLowerCase()){idx=i;break;}}return idx;};function LanguageFunctions(){}LanguageFunctions.prototype.greet=function(){var str=new Array();str[0]="Hi. ";str[1]="Hello. ";var hr=new Date().getHours();if(hr<12){str[2]="Good morning. ";}else{if(hr<18){str[2]="Good afternoon. ";}else{str[2]="Good evening. ";}}return str[Math.floor(Math.random()*str.length)];};LanguageFunctions.prototype.sayName=function(name){var str=new Array();str[0]="My name's ";str[1]="I'm ";return str[Math.floor(Math.random()*str.length)]+name+". ";};LanguageFunctions.prototype.introducePage=function(title){var str=new Array();str[0]="Welcome to ";str[1]="This is ";return str[Math.floor(Math.random()*str.length)]+title+". ";};LanguageFunctions.prototype.confirm=function(){var str=new Array();str[0]="Good. ";str[1]="Right. ";str[2]="Fine. ";str[3]="Yes. ";str[4]="Right you are. ";str[5]="Quite right. ";str[6]="That's right. ";str[7]="That's it. ";str[8]="That's correct. ";return str[Math.floor(Math.random()*str.length)];};LanguageFunctions.prototype.correct=function(){var str=new Array();str[0]="No, that's wrong. ";str[1]="Not really. ";str[2]="Unfortunately not. ";str[3]="I'm afraid that's not quite right. ";str[4]="Sorry, that's not right. ";str[5]="No, I don't think that's right. ";return str[Math.floor(Math.random()*str.length)];};LanguageFunctions.prototype.sayGrade=function(ok,n){var grade=Math.round(100*ok/n);var str=new Array();if(grade>=90){str[0]="Excellent! ";str[1]="Fantastic! ";str[2]="Marvellous! ";str[3]="Terrific! ";str[4]="Wow! ";}else if(grade>=80){str[0]="Very good! ";str[1]="Well done! ";str[2]="That was very good. ";str[3]="That was very fine. ";}else if(grade>=70){str[0]="That was quite good. ";str[1]="That was quite fine. ";}else if(grade>=60){str[0]="That was fairly good. ";str[1]="That was fairly fine. ";}else if(grade>=20){str[0]="That wasn't very good. ";str[1]="That was rather disappointing. ";str[2]="I wasn't very satisfied with that. ";str[3]="I wasn't very satisfied with the way you did that. ";str[4]="You can do better than that. ";str[5]="Come on, can't you do any better than that? ";str[6]="You must try harder. ";str[7]="I hope you do it better next time. ";}else{str[0]="Oh dear! That was awful. ";str[1]="Oh dear! That was terrible. ";str[2]="Oh dear! That was rotten. ";}return str[Math.floor(Math.random()*str.length)]+"You scored "+("correct answer".addNumber(ok))+" out of a total of "+n+".";};LanguageFunctions.prototype.congratulate=function(){var str=new Array();str[0]="Congratulations! ";str[1]="Well done! ";str[2]="Fantastic! ";str[3]="Terrific! ";return str[Math.floor(Math.random()*str.length)];};LanguageFunctions.prototype.showSympathy=function(){var str=new Array();var s;str[0]="Oh no! ";str[1]="Oh dear. ";s=str[Math.floor(Math.random()*str.length)];str[0]="I'm sorry ";str[1]="I'm afraid ";return s+str[Math.floor(Math.random()*str.length)];};