take = 0
askhistorian = 0
takevote = 0
index = 0
boxes=new Array()
function start()
{
play()
}
function play()
{
questionchoice=Math.round((availablegames-1) * Math.random())
fling.questiondisplay.SetVariable("question",game[questionchoice][index][0]);
fling.questiondisplay.SetVariable("authorfield","
Question by "+game[questionchoice][index][5]+"")
document.fling.status.value = (15-index)+" questions from take off!"
if (index==14) {document.fling.status.value = (15-index)+" question from take off!"}
for(n=0; n<=4; n++){
boxes[n]="";
}
count=1
doit()
fling.answerdisplay.SetVariable("answera",boxes[0]);
fling.answerdisplay.SetVariable("answerb",boxes[1]);
fling.answerdisplay.SetVariable("answerc",boxes[2]);
fling.answerdisplay.SetVariable("answerd",boxes[3]);
}
function doit()
{for(n=1; n<=500; n++){
randnum=Math.round(3 * Math.random())
if (boxes[randnum] == "")
{ boxes[randnum] = game[questionchoice][index][count]
if(count==1)
{
correctanswer=[boxes[randnum]];
if (randnum == 0){actualcorrect= "a";}
if (randnum == 1){actualcorrect= "b";}
if (randnum == 2){actualcorrect= "c";}
if (randnum == 3){actualcorrect= "d";}
}
count++}}}
function checkanswer(x)
{
if (confirm("Are you sure about your answer?"))
{if (x==actualcorrect)
{
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
{
fling.answerdisplay.TGotoFrame("_level0",1);
alert("I'm sorry but you are incorrect. The answer was actually "+correctanswer+"!")
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(); take=1}}
function dotake()
{
for(n=1; n<=100; n++)
{
randnum=Math.round(3 * Math.random())
if (boxes[randnum] != correctanswer)
{if (boxes[randnum] != "---------------")
{boxes[randnum] = "---------------"
count++
if (count==3)
break}
}
}
fling.answerdisplay.SetVariable("answera",boxes[0]);
fling.answerdisplay.SetVariable("answerb",boxes[1]);
fling.answerdisplay.SetVariable("answerc",boxes[2]);
fling.answerdisplay.SetVariable("answerd",boxes[3]);
}
function askahistorian()
{
if (askhistorian == 1)
{alert("You have already asked an expert!")}
else if (askhistorian == 0)
{
answerstring=correctanswer
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()))
fling.movie.SetVariable("expertresponse",response[randnum]);
fling.movie.TGotoFrame("_level0",16);
}
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.")
// set height for correct answer
// if less or equal to question 7, then show correct 'more clearly'
if (index <= 7){
correct_show = 40+(Math.round(60 * Math.random()));}
else {fixer = 2*(20-index);
correct_show = fixer+(Math.round((65-fixer) * Math.random()));}
if (actualcorrect == "a") {height_a = correct_show};
if (actualcorrect == "b") {height_b = correct_show};
if (actualcorrect == "c") {height_c = correct_show};
if (actualcorrect == "d") {height_d = correct_show};
// depending on height for correct answer, distribute others
remaining_show = 100-correct_show;
dividefactor = 1+(Math.round(4 * Math.random()));
remaining_show1 = Math.round(remaining_show/dividefactor);
remaining_show = remaining_show - remaining_show1;
dividefactor = 1+(Math.round(4 * Math.random()));
remaining_show2 = Math.round(remaining_show/dividefactor);
remaining_show3 = remaining_show - remaining_show2;
if (actualcorrect == "a") {height_b = remaining_show1; height_c = remaining_show2; height_d = remaining_show3};
if (actualcorrect == "b") {height_a = remaining_show1; height_c = remaining_show2; height_d = remaining_show3};
if (actualcorrect == "c") {height_a = remaining_show1; height_b = remaining_show2; height_d = remaining_show3};
if (actualcorrect == "d") {height_a = remaining_show1; height_b = remaining_show2; height_c = remaining_show3};
// check to see if take2away
correctheight = 0
if (boxes[0]=="---------------") {correctheight=correctheight+height_a; height_a = 0};
if (boxes[1]=="---------------") {correctheight=correctheight+height_b; height_b = 0};
if (boxes[2]=="---------------") {correctheight=correctheight+height_c; height_c = 0};
if (boxes[3]=="---------------") {correctheight=correctheight+height_d; height_d = 0};
// distribute take2away to correctanswer
if (actualcorrect == "a") {height_a = height_a + correctheight};
if (actualcorrect == "b") {height_b = height_b + correctheight};
if (actualcorrect == "c") {height_c = height_c + correctheight};
if (actualcorrect == "d") {height_d = height_d + correctheight};
fling.movie.SetVariable("aheight",height_a);
fling.movie.SetVariable("bheight",height_b);
fling.movie.SetVariable("cheight",height_c);
fling.movie.SetVariable("dheight",height_d);
fling.movie.TGotoFrame("_level0",17);
}
takevote = 1
}
function letteacheroff()
{
if (confirm("Are you sure you want to let the teacher get away?"))
{alert("The correct answer was actually \'"+correctanswer+"\'!")
location.href="continue.html"}
}