take = 0 askhistorian = 0 takevote = 0 index = 0 boxes=new Array ("a","b","c","d") function swapImage(imgName,newSrc){ oldSrc=document.images[imgName].src oldImg=imgName document.images[imgName].src=newSrc } function swapBack(){ document.images[oldImg].src=oldSrc } function start() { play() } function play() { questionchoice=Math.round((availablegames-1) * Math.random()) document.fling.questionbox.value = game[questionchoice][index][0] document.fling.author.value = "Question by "+game[questionchoice][index][5] document.fling.a.value = "" document.fling.b.value = "" document.fling.c.value = "" document.fling.d.value = "" document.fling.status.value = (15-index)+" questions from take off!" if (index==14) {document.fling.status.value = (15-index)+" question from take off!"} count=1 doit() } function doit() {for(n=1; n<=500; n++){ randnum=Math.round(3 * Math.random()) if (document.fling[boxes[randnum]].value == "") { document.fling[boxes[randnum]].value = game[questionchoice][index][count] if(count==1) {correctanswer=[boxes[randnum]]} count++}}} function checkanswer(x) { if (confirm("Are you sure about your answer?")) {if (x==correctanswer) { index++ if (index!=15) { if (index<=13) { response=Math.round(4 * Math.random()) if (response==0) {alert("Excellent answer!\n"+(15-index)+" answers away from a flying teacher.");} if (response==1) {alert("Correct answer!\nYou are "+(15-index)+" questions away from flinging the teacher.");} if (response==2) {alert("You are correct!\nThat means you have "+(15-index)+" questions left to fling the teacher.");} if (response==3) {alert("Good choice!\nYou are now "+(15-index)+" correct answers from seeing that teacher fly.");} if (response==4) {alert("Well done!\nThe countdown continues - "+(15-index)+" question until lift off!");} } else { alert("Correct answer!\nYou are now only one question away from flinging the teacher!") } fling.movie.TGotoFrame("_level0",index); fling.scoring.TGotoFrame("_level0",index); play() } else { alert("You are correct!\nGet ready....") location.href = "continuewin.htm" } } else {alert("I'm sorry but you are incorrect. The answer was actually "+document.fling[correctanswer].value+"!") location.href="continue.html"} } } function taketwo() {if (take != 0) {alert("Sorry! You have already taken two away.")} else if (take == 0) { alert("Two incorrect answers will be removed!") count=1; dotake(); document.fling.take.src="../images/take2done.gif"; take=1}} function dotake() { for(n=1; n<=100; n++) { randnum=Math.round(3 * Math.random()) if (boxes[randnum] != correctanswer) {if (document.fling[boxes[randnum]].value != "---------------") {document.fling[boxes[randnum]].value = "---------------" count++ if (count==3) break} } } } function askahistorian() { if (askhistorian == 1) {alert("You have already asked a historian!")} else if (askhistorian == 0) { answerstring=document.fling[correctanswer].value closegif="../images/close.gif" response = new Array () response [0] = "Simple! The answer is without a doubt "+answerstring response [1] = "I know this one! The answer is definitely "+answerstring response [2] = "What a simple question! The answer is "+answerstring response [3] = "I'm pretty sure that the answer is "+game[questionchoice][index][2] response [4] = "I'm pretty sure that the answer is "+answerstring response [5] = "I'm not 100% certain, but I think that the answer is "+answerstring response [6] = "I think the answer is "+answerstring response [7] = "I'm not 100% certain, but I think that the answer is "+game[questionchoice][index][4] response [8] = "Something tells me it is "+answerstring+" but I'm not too sure..." response [9] = "Something tells me it is "+game[questionchoice][index][3]+" but I'm not too sure..." response [10] = "I'm sorry, but I haven't got the faintest idea!" randnum=Math.round((index/2)+(3 * Math.random())) ansa=document.fling.a.value ansb=document.fling.b.value ansc=document.fling.c.value ansd=document.fling.d.value newWindow =window.open("",'displayWindow','fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); newWindow.resizeTo(440,260); newWindow.moveTo(20,260); newWindow.document.write("Ask a historian
"); newWindow.document.write("
"); newWindow.document.write("
"); newWindow.document.write("
"); newWindow.document.write("
"); newWindow.document.write("
"); newWindow.document.write("
"); newWindow.document.write("
"); newWindow.document.write("
"); newWindow.document.write("
"); line1 = "[The musician:] Hello. What can I do for you?\r\n\r\n" if (index<=13) {line2 = "[You:] I am trying to fling a teacher and am" + " " + (15-index) + " " + "questions away. I need your help!\r\n\r\n"} else {line2 = "[You:] I am trying to fling a teacher and am just one question away. I need your help!\r\n\r\n"} line3 = "" line4 = "" line5 = "[You:] " + "'" + game[questionchoice][index][0] + "'\r\n" line6 = " A: " + ansa + "?\r\n B: " + ansb + "?\r\n C: " + ansc + "?\r\n D: " + ansd + "?\r\n" line7 = "\r\n[The musician:] " + response[randnum] + "\r\n\r\n" line8 = "[You:] Thanks..." ti = 1 for(ti=1; ti<=8; ti++) { if (ti==5) {setTimeout('newWindow.document.questionask.ask.value = line'+ti, 200+(1300*ti)); } else {setTimeout('newWindow.document.questionask.ask.value = newWindow.document.questionask.ask.value + line'+ti, 200+(1300*ti)); } } closer = new Image(); closer.src = "../images/close.gif" setTimeout("newWindow.document.images['closegif'].src = closer.src", 10600); } document.fling.askhistorian.src = "../images/askhistoriandone.gif" askhistorian=1 } function takeavote(){ if (takevote == 1) {alert("You have already taken a vote")} else if (takevote == 0) {alert("Voting has taken place.\nClick OK for results.") votechoose = Math.round((index/7)+(2 * Math.random())); answergif="../images/voting/ans"+correctanswer+votechoose+".gif" newWindow =window.open("",'displayWindow','fullscreen=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); newWindow.resizeTo(440,260); newWindow.moveTo(20,260); newWindow.document.write("Voting Results"); newWindow.document.write(""); newWindow.document.write("
"); newWindow.document.write("
"); newWindow.document.write("
"); newWindow.document.write(""); newWindow.document.close() newWindow.document["answergif"].src = answergif } takevote = 1 document.fling.vote.src = "../images/takeavotedone.gif" } function letteacheroff() { if (confirm("Are you sure you want to let the teacher get away?")) {alert("The correct answer was actually \'"+document.fling[correctanswer].value+"\'!") location.href="continue.html"} }