

//<![CDATA[

<!--

// BrowserCheck Object

function BrowserCheck() {
	var b = navigator.appName
//HBS extension
	this.mac = (navigator.appVersion.indexOf('Mac') != -1)
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.min = (this.ns||this.ie)
	this.CRAPBrowser = (this.ie4 && this.mac); //Cannot Resolve Addresses Properly
}

is = new BrowserCheck();

var LocFolder = GetFolder(window.location.href);
function GetFolder(LocPath){
	LocPath = ReplaceStuff('\'','%27',LocPath);
	var i = LocPath.lastIndexOf('/');
	if (i<0){i=LocPath.lastIndexOf('\\')};
	return LocPath.substring(0,i);
}

function CombineURLs(InURL){
	var i = InURL.indexOf('../');
	var s = LocFolder;
	while (i >- 1){
		s = GetFolder(s);
		InURL = InURL.substring(3,InURL.length);
		i = InURL.indexOf('../');
	}
	return s + '/' + InURL;
}

x = new Array();
function ResolveURLs(InText,Attribute){
	x.length=0;
	var Temp = InText.toLowerCase();
	var z;
	var AttLen = Attribute.length + 2;
	var y=Temp.lastIndexOf(Attribute + '="');
	while (y>-1){
		var sLoc = y+AttLen;
		if (Temp.substring(sLoc,sLoc+5) != 'http:'){
			x[x.length]=new Array();
			x[x.length-1][0] = sLoc;
			z = Temp.indexOf('"',sLoc);
			x[x.length-1][1] = z;
			x[x.length-1][2] = InText.substring(sLoc,z);

		}
		Temp = Temp.substring(0,y);
		y=Temp.lastIndexOf(Attribute + '="');
	}
	for (var j=0; j<x.length; j++){
		InText = InText.substring(0,x[j][0]) + CombineURLs(x[j][2]) + InText.substring(x[j][1], InText.length);
	}
	return InText;
}



function ResolveAllURLs(Stuff){
	Stuff = ResolveURLs(Stuff,'href');
	Stuff = ResolveURLs(Stuff,'src');
	Stuff = ResolveURLs(Stuff,'parent.location');
	return Stuff;
}


var ExBGColor = '#bbbbee';



var PageBGColor = '#ffffff';



var NavBarColor = '#000066';


var TextColor = '#000000';
var CurrQNum = 0;
var ALetters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var CorrectIndicator = 'yes! :)';
var IncorrectIndicator = 'nope :(';
var YourScoreIs = 'Your score is ';
var Tries = 0;
var CorrectChoices = 0;
var ContinuousScoring = true;
var CorrectFirstTime = 'Questions answered correctly first time: ';var ExerciseTitle = 'Alice Martineau Extreme Quiz number 2!';
var ExerciseSubtitle = 'the new and more extreme Alice Martineau Quiz';
var Instructions = 'Choose the correct answer for each question.'; //'';
var ShuffleQs = false;
var ShuffleAs = false;
var DefaultRight = 'Correct!';
var DefaultWrong = 'Sorry! Try again.';
var QsToShow = 10;
var ShowOneByOne = true;
var ReadingURL = '';
var EraseFeedback = true;
var Score = 0;

var PreviousPage = history.length;







var NavBar='';


NavBar+='<tr><form name="NavButtons1" action=""><td bgcolor="#000066" align="center">';
NavBar+='<font face="Geneva,Arial" size="-1">';

NavBar+='<input type="button" value="back" onclick="parent.GoBack()"></input>';



NavBar+='</font></td></form></tr>';
if (is.CRAPBrowser){NavBar=ResolveAllURLs(NavBar)};


var TitleCode = '<tr><td align="center" valign="middle" bgcolor="#ffffff">';
TitleCode += '<font size="+1" face="Geneva,Arial" color="#000033">' + ExerciseTitle + '</font><br />';
TitleCode += '<font size="-1" face="Geneva,Arial" color="#000033">' + ExerciseSubtitle + '<br />';
TitleCode += '</font></td></tr>';

var QButtonsOpener = '<table border="0" width="85%" cellpadding="10">';
QButtonsOpener += '<tr><td align="center" valign="middle"><form>';
QButtonsOpener += '<font size="+1"><input type="button" value="prev" onclick="parent.ChangeQ(-1)"></input>';
var QButtonsCloser = '<input type="button" value="next" onclick="parent.ChangeQ(1)"></input>';
QButtonsCloser += '</font></form></td></tr></table>';

var TableOpener = '<form name="QForm">';
TableOpener += '<table border="0" width="85%">';
var QRow = '<tr><td valign="top" bgcolor="#bbbbee" align="right">';
QRow += '<font size="+1" face="Geneva,Arial" color="#000000">[QNumber]</font></td>';
QRow += '<td colspan="3" valign="top" bgcolor="#bbbbee"><font size="-1" face="Geneva,Arial" color="#000000">[Question]<br />&nbsp;';
QRow += '</font></td></tr>';

var ARow = '<tr><td></td><td valign="top" bgcolor="#bbbbee"><input type="text" value=" " size="3" name="FB_[QNum]_[ANum]"></input></td>';
ARow += '<td valign="top" bgcolor="#bbbbee"><input type="button" value="[ALetter]" OnClick="parent.CheckAnswer([QNum],[ANum])"></input></td>';
ARow += '<td width="100%" bgcolor="#bbbbee"><font size="-1" face="Geneva,Arial" color="#000000">[Ans]</font></td></tr>';

var MARow = '<tr><td></td><td valign="top" bgcolor="#bbbbee" colspan="3"><input type="checkbox" name="A_[QNum]_[ANum]" value="[Correct]"></input>';
MARow += '<font size="-1" face="Geneva,Arial" color="#000000">[Ans]</font></td></tr>';

var CheckButton = '<tr><td></td><td valign="top" bgcolor="#bbbbee" ><input type="button" value="Check"';
CheckButton += ' onclick="parent.CheckMulti([QNum])"></input></td></tr>';

TableCloser = '</table></form>';

function GoBack(){
	var BackSkip = history.length - PreviousPage;
	if (BackSkip > 0){
		history.go((BackSkip+1)*-1);
	}
	else{
		parent.history.back();
	}
}

function ReduceItems(){
	var ItemToDump=0;
	var j=0;
	while (I.length > QsToShow){
		ItemToDump = Math.floor(I.length*Math.random());
		for (j=ItemToDump; j<(I.length-1); j++){
			I[j] = I[j+1];
		}
		I.length = I.length-1;
	}
}

function Shuffle(InArray){
	Temp = new Array();
	var Len = InArray.length;

	var j = Len;

	for (var i=0; i<Len; i++){
		Temp[i] = InArray[i];
	}

	for (i=0; i<Len; i++){
		Num = Math.floor(j  *  Math.random());
		InArray[i] = Temp[Num];

		for (var k=Num; k < j; k++) {
			Temp[k] = Temp[k+1];
		}
		j--;
	}
	return InArray;
}

function WriteFeedback(Feedback) {
//Build the output string
	var OutString = '';
	OutString += '<html>';
	OutString += '<body  background="" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000cc">';
	OutString += '<center><table border="0" cellpadding="5" cellspacing="1" width="85%">';
	OutString += NavBar;
	if (Feedback.length>0){
		OutString += '<tr><td bgcolor="#bbbbee" align="center">'; 
		OutString += '<font face="Geneva,Arial" size="-1" color="#000000">';
		OutString += Feedback;
		OutString += '</font></td></tr>'
	}
	OutString += '</table></center></body></html>';

	if (is.CRAPBrowser){OutString=ResolveAllURLs(OutString);}

//Write it to the frame
	TopFrame.document.clear();
	TopFrame.document.open();
	TopFrame.document.write(OutString);
	TopFrame.document.close();
}

function StartUp(){




//Reduce array if required
	if (QsToShow < I.length){
		ReduceItems();
	}

//Shuffle stuff if required

	if (ShuffleQs == true){
		I = Shuffle(I);
	}

	if (ShuffleAs == true){
		for (var i=0; i<I.length; i++){
			I[i][1] = Shuffle(I[i][1]);
		}
	}

//Create arrays
	CreateStatusArrays();



//Show the first question or all of them
	if (ShowOneByOne == false){
		ShowAllQs();
	}
	else{
		ShowQuestion(CurrQNum);
	}

//Write the top frame
	WriteFeedback(Instructions);
}


I = new Array();

I[0] = new Array();
I[0][0]='where in London did Alice live?';
I[0][1] = new Array();
I[0][1][0] = new Array();
I[0][1][0][0]='kensington';
I[0][1][0][1]='nope, try again :)';
I[0][1][0][2] = 0;
I[0][1][1] = new Array();
I[0][1][1][0]='notting hill';
I[0][1][1][1]='correct, how many guesses did it take? :)';
I[0][1][1][2] = 1;
I[0][1][2] = new Array();
I[0][1][2][0]='finchley';
I[0][1][2][1]='nope, keep trying!';
I[0][1][2][2] = 0;
I[0][1][3] = new Array();
I[0][1][3][0]='westminster';
I[0][1][3][1]='nope, maybe you\'ll get it next time';
I[0][1][3][2] = 0;
I[0][1][4] = new Array();
I[0][1][4][0]='London city, overlooking the thames';
I[0][1][4][1]='try again, you may get it next time';
I[0][1][4][2] = 0;
I[0][2] = 0;

I[1] = new Array();
I[1][0]='in a documentary, Alice says that one of her friends likes an island, what is the name';
I[1][1] = new Array();
I[1][1][0] = new Array();
I[1][1][0][0]='isle of wight';
I[1][1][0][1]='keep trying';
I[1][1][0][2] = 0;
I[1][1][1] = new Array();
I[1][1][1][0]='isle of man';
I[1][1][1][1]='not this one, sorry!';
I[1][1][1][2] = 0;
I[1][1][2] = new Array();
I[1][1][2][0]='ireland';
I[1][1][2][1]='think smaller! a lot smaller!!';
I[1][1][2][2] = 0;
I[1][1][3] = new Array();
I[1][1][3][0]='isle of mull';
I[1][1][3][1]='you got it!!!!!';
I[1][1][3][2] = 1;
I[1][1][4] = new Array();
I[1][1][4][0]='gibraltar';
I[1][1][4][1]='nope, not this one!';
I[1][1][4][2] = 0;
I[1][2] = 0;

I[2] = new Array();
I[2][0]='What is Alice is described as, by her older brother in the bbc documentary';
I[2][1] = new Array();
I[2][1][0] = new Array();
I[2][1][0][0]='the naughty one';
I[2][1][0][1]='yes, you got it!!';
I[2][1][0][2] = 1;
I[2][1][1] = new Array();
I[2][1][1][0]='the nice one';
I[2][1][1][1]='nope, try again!';
I[2][1][1][2] = 0;
I[2][1][2] = new Array();
I[2][1][2][0]='the shorter one';
I[2][1][2][1]='try again, you fell short on this one!';
I[2][1][2][2] = 0;
I[2][1][3] = new Array();
I[2][1][3][0]='the most talkative one';
I[2][1][3][1]='don\'t stop now, only 4 more to try!';
I[2][1][3][2] = 0;
I[2][1][4] = new Array();
I[2][1][4][0]='the clever one';
I[2][1][4][1]='keep trying :)';
I[2][1][4][2] = 0;
I[2][2] = 0;

I[3] = new Array();
I[3][0]='Alice says She always felt that She and What fictional character are the same person';
I[3][1] = new Array();
I[3][1][0] = new Array();
I[3][1][0][0]='Batman';
I[3][1][0][1]='nope, not even batgirl or robin!';
I[3][1][0][2] = 0;
I[3][1][1] = new Array();
I[3][1][1][0]='Buffy the vampire slayer';
I[3][1][1][1]='you staked out on that guess';
I[3][1][1][2] = 0;
I[3][1][2] = new Array();
I[3][1][2][0]='Alice in wonderland';
I[3][1][2][1]='this answer fell down a rabbit hole';
I[3][1][2][2] = 0;
I[3][1][3] = new Array();
I[3][1][3][0]='E.T.';
I[3][1][3][1]='phone home! you got it right!';
I[3][1][3][2] = 1;
I[3][1][4] = new Array();
I[3][1][4][0]='Alf';
I[3][1][4][1]='that guess was out of this world!';
I[3][1][4][2] = 0;
I[3][2] = 0;

I[4] = new Array();
I[4][0]='What living thing did Alice say she disliked?';
I[4][1] = new Array();
I[4][1][0] = new Array();
I[4][1][0][0]='Rats';
I[4][1][0][1]='rats, you got it wrong!';
I[4][1][0][2] = 0;
I[4][1][1] = new Array();
I[4][1][1][0]='Dogs';
I[4][1][1][1]='you\'re barking up the wrong tree!';
I[4][1][1][2] = 0;
I[4][1][2] = new Array();
I[4][1][2][0]='Bees and Wasps';
I[4][1][2][1]='no sting in this tail, try again!';
I[4][1][2][2] = 0;
I[4][1][3] = new Array();
I[4][1][3][0]='Snakes';
I[4][1][3][1]='slithering serpents, you\'re wrong!';
I[4][1][3][2] = 0;
I[4][1][4] = new Array();
I[4][1][4][0]='Spiders';
I[4][1][4][1]='Eek a spider! I mean, correct!';
I[4][1][4][2] = 1;
I[4][2] = 0;


I[5] = new Array();
I[5][0]='What was the name of the first university Alice went to?';
I[5][1] = new Array();
I[5][1][0] = new Array();
I[5][1][0][0]='King\'s College';
I[5][1][0][1]='no! this was the 2nd!!';
I[5][1][0][2] = 0;
I[5][1][1] = new Array();
I[5][1][1][0]='University of Oxford';
I[5][1][1][1]='this is no boat race, you got it wrong!';
I[5][1][1][2] = 0;
I[5][1][2] = new Array();
I[5][1][2][0]='Coventry University';
I[5][1][2][1]='nope, keep trying!';
I[5][1][2][2] = 0;
I[5][1][3] = new Array();
I[5][1][3][0]='Warwick University';
I[5][1][3][1]='you got it right!';
I[5][1][3][2] = 1;
I[5][1][4] = new Array();
I[5][1][4][0]='University of Nottingham';
I[5][1][4][1]='nope, nott here!';
I[5][1][4][2] = 0;
I[5][2] = 0;

I[6] = new Array();
I[6][0]='What agency did Alice do modelling with?';
I[6][1] = new Array();
I[6][1][0] = new Array();
I[6][1][0][0]='Nevs model Agency';
I[6][1][0][1]='that\'s right! you got it!';
I[6][1][0][2] = 1;
I[6][1][1] = new Array();
I[6][1][1][0]='Solar Agency';
I[6][1][1][1]='don\'t let the sun set on this one';
I[6][1][1][2] = 0;
I[6][1][2] = new Array();
I[6][1][2][0]='Mustard model Agency';
I[6][1][2][1]='this one is too hot!';
I[6][1][2][2] = 0;
I[6][1][3] = new Array();
I[6][1][3][0]='Flower Petal Agency';
I[6][1][3][1]='I don\'t think they even exist!';
I[6][1][3][2] = 0;
I[6][1][4] = new Array();
I[6][1][4][0]='whites and blane modelling';
I[6][1][4][1]='another made up name, they don\'t even exist!';
I[6][1][4][2] = 0;
I[6][2] = 0;

I[7] = new Array();
I[7][0]='at which gig location did Robbie Williams hear Alice Martineau sing?';
I[7][1] = new Array();
I[7][1][0] = new Array();
I[7][1][0][0]='The Kashmir';
I[7][1][0][1]='wrong! try again!';
I[7][1][0][2] = 0;
I[7][1][1] = new Array();
I[7][1][1][0]='606 Jazz Club';
I[7][1][1][1]='correct! jazzy answer!';
I[7][1][1][2] = 1;
I[7][1][2] = new Array();
I[7][1][2][0]='china whites';
I[7][1][2][1]='not even the right continent, keep trying!';
I[7][1][2][2] = 0;
I[7][1][3] = new Array();
I[7][1][3][0]='The Ten Rooms';
I[7][1][3][1]='ten rooms to guess and you still got it wrong!';
I[7][1][3][2] = 0;
I[7][1][4] = new Array();
I[7][1][4][0]='the white hart lane';
I[7][1][4][1]='perhaps you should go back to the hard quiz, this one doesn\'t exist!';
I[7][1][4][2] = 0;
I[7][2] = 0;

I[8] = new Array();
I[8][0]='Alice has a tattoo shaped like the letter S, what is it?';
I[8][1] = new Array();
I[8][1][0] = new Array();
I[8][1][0][0]='it\'s a letter of the alphabet, don\'t try to trick me!';
I[8][1][0][1]='wrong! it\'s just shaped like an S, it\'s not that though!';
I[8][1][0][2] = 0;
I[8][1][1] = new Array();
I[8][1][1][0]='A small snake';
I[8][1][1][1]='wrong! you can\'t slither away with that one!';
I[8][1][1][2] = 0;
I[8][1][2] = new Array();
I[8][1][2][0]='The chinese symbol for determination';
I[8][1][2][1]='you are determined to get this answer, try again!';
I[8][1][2][2] = 0;
I[8][1][3] = new Array();
I[8][1][3][0]='You lie! She doesn\'t have a tattoo!';
I[8][1][3][1]='wrong! it\'s on her left arm!';
I[8][1][3][2] = 0;
I[8][1][4] = new Array();
I[8][1][4][0]='A Flower';
I[8][1][4][1]='correct! you got it!';
I[8][1][4][2] = 1;
I[8][2] = 0;

I[9] = new Array();
I[9][0]='What is Alice\'s earliest childhood memory?';
I[9][1] = new Array();
I[9][1][0] = new Array();
I[9][1][0][0]='getting lost in a wood with her brother';
I[9][1][0][1]='timber! you got it right!';
I[9][1][0][2] = 1;
I[9][1][1] = new Array();
I[9][1][1][0]='watching her grandmother play the piano';
I[9][1][1][1]='you don\'t have the key to this one!';
I[9][1][1][2] = 0;
I[9][1][2] = new Array();
I[9][1][2][0]='chasing her cat round the back garden';
I[9][1][2][1]='nice try kitten, you\'ll be a tiger some day.';
I[9][1][2][2] = 0;
I[9][1][3] = new Array();
I[9][1][3][0]='Singing along to her mothers records';
I[9][1][3][1]='nope, face the music on this one!';
I[9][1][3][2] = 0;
I[9][1][4] = new Array();
I[9][1][4][0]='finding her mother\'s records and breaking them in half';
I[9][1][4][1]='you won\'t be breaking any records with this answer!';
I[9][1][4][2] = 0;
I[9][2] = 0;




Status = new Array();


function CreateStatusArrays(){
	for (var x=0; x<I.length; x++){
		Status[x] = new Array();
		Status[x][0] = 0; // Question not done yet
		Status[x][1] = new Array(); //for tracking whether answers chosen
		for (var y=0; y<I[x][1].length; y++){
			Status[x][1][y] = '0'; //Answers not chosen yet
		}
		Status[x][2] = 0; //Wrong tries at this question so far
		Status[x][3] = 0; //For storing score out of one on this question
	}
}

function UpdateQuestionStatus(QNum){
	if (Status[QNum][2] >= Status[QNum][1].length-1){
		Status[QNum][0] = 1;
		for (var i=0; i<Status[QNum][1].length; i++){
			if (Status[QNum][1][i] == '0'){
				Status[QNum][1][i] = 'R';
			}
		}
	}
}

function ReplaceStuff(Token, Replacement, InString){
	var i = InString.indexOf(Token);
	var FirstBit = '';
	var LastBit = '';
	while (i>-1){
		FirstBit = InString.substring(0, i);
		LastBit = InString.substring(i + Token.length, InString.length);	
		InString = FirstBit + Replacement + LastBit;
		i = InString.indexOf(Token);
	}
	return InString;
}

function ChangeQ(ChangeBy){
	var NewNum = CurrQNum + ChangeBy;
	if ((NewNum >= 0)&&(NewNum<I.length)){
		CurrQNum = NewNum;
		ShowQuestion(CurrQNum);
	}
	var CurrScore = '';
	if ((ContinuousScoring == true)&&(EraseFeedback == true)){
		CalculateScore();
		var CurrScore = YourScoreIs + ' ' + Score + '%.';
		WriteFeedback(CurrScore);
	}
}

function BuildQuestion(QNum){
	if (I[QNum][2] == 0){
		var Temp = ReplaceStuff('[Question]', I[QNum][0], QRow);

		var AnsRows = '';
		for (var i=0; i<I[QNum][1].length; i++){
			TempAns = ARow;
			TempAns = ReplaceStuff('[ANum]', i, TempAns);
			TempAns = ReplaceStuff('[ALetter]', ' ' + ALetters.charAt(i) + ' ', TempAns);
			TempAns = ReplaceStuff('[Ans]', I[QNum][1][i][0], TempAns);
			AnsRows += TempAns;
		}
		Temp += AnsRows;
		Temp = ReplaceStuff('[QNumber]', QNum+1, Temp);
		Temp = ReplaceStuff('[QNum]', QNum, Temp);
	}
	else{
		var Temp = ReplaceStuff('[Question]', I[QNum][0], QRow);
		var AnsRows = '';
		for (var i=0; i<I[QNum][1].length; i++){
			TempAns = MARow;
			TempAns = ReplaceStuff('[ANum]', i, TempAns);
			TempAns = ReplaceStuff('[Correct]', I[QNum][1][i][2], TempAns);
			TempAns = ReplaceStuff('[Ans]', I[QNum][1][i][0], TempAns);
			AnsRows += TempAns;
		}
		Temp += AnsRows;
		Temp += CheckButton;
		Temp = ReplaceStuff('[QNumber]', QNum+1, Temp);
		Temp = ReplaceStuff('[QNum]', QNum, Temp);
	}
	return Temp;
}

function DisplayExercise(StuffToDisplay){
//Build the output string
	var OutString = '';
	OutString += '<html>';
	OutString += '<body  background="" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000cc">';
	OutString += '<center><table border="0" cellpadding="5" cellspacing="1" width="85%">';
	OutString += TitleCode; 
	OutString += '<tr><td bgcolor="#bbbbee" align="center">'; 
	OutString += '<font face="Geneva,Arial" size="-1">';
	OutString += StuffToDisplay;
	OutString += '</font></td></tr>';
	OutString += NavBar;
	OutString += '</table></center></body></html>';

	if (is.CRAPBrowser){OutString=ResolveAllURLs(OutString);}

//Write it to the frame
	BottomFrame.document.clear();
	BottomFrame.document.open();
	BottomFrame.document.write(OutString);
	BottomFrame.document.close();
}


function ShowAllQs(){
	var Output = '';
	for (var i=0; i<I.length-1; i++){
		Output = Output + BuildQuestion(i);
		Output = Output + '<tr><td colspan="4"><hr></hr></td></tr>';
	}
	Output = Output + BuildQuestion(I.length-1);
	Output = TableOpener + Output + TableCloser;
	DisplayExercise(Output);
}

function ShowQuestion(QNum){
//First, create the Q number readout at the top
	var Readout = (QNum+1) + '/' + I.length;
	while (Readout.length < 7){
		Readout = ' ' + Readout + ' ';
	}
	Readout = QButtonsOpener + Readout + QButtonsCloser;

	var Output = BuildQuestion(QNum);

	Output = TableOpener + Output + TableCloser;

	DisplayExercise(Readout + Output);

//Mark the answers already done
	for (i=0; i<Status[QNum][1].length; i++){
		if (Status[QNum][1][i] == 'R'){
			MarkAnswer(QNum,i,true)
		}
		if (Status[QNum][1][i] == 'W'){
			MarkAnswer(QNum,i,false)
		}
		if (Status[QNum][1][i] == 'C'){
			CheckCheckbox(QNum,i);
		}
	}
//Eliminate feedback from previous question
	if (EraseFeedback == true){
		WriteFeedback('');
	}
}

function CheckMulti(QNum){
	var TotWrong = 0;
	var Output = '';
	var TotAns = I[QNum][1].length;
	for (var i=TotAns-1; i>=0; i--){
//Find any incorrect choices

		var b = eval('BottomFrame.document.QForm.A_' + QNum + '_' + i);

		if (b != null){
//if it's wrong, count it
			if (b.checked == true){
				Status[QNum][1][i] = 'C';
			}
			else{
				Status[QNum][1][i] = 'U';
			}
			if (((b.checked == true) && (b.value == "0"))||((b.checked == false)&&(b.value == "1"))){
				TotWrong++;
			}
		}				
	}

	if (TotWrong == 0){
		Output = DefaultRight;
	}
	else{
		Output = DefaultWrong + '<br />' + (TotAns-TotWrong) + '/' + TotAns;
	}

//If you haven't tried the question before
	if (Status[QNum][0] == 0){
		if (TotWrong > 0){
			Status[QNum][2]++;
		}
		if (TotWrong == 0){
			Status[QNum][0] = 1;
//Calculate the score for this question as a floating-point fraction of 1
			Status[QNum][3] =  ((Status[QNum][1].length - Status[QNum][2]) - 1) / (Status[QNum][1].length - 1);
//If less than zero, set to zero
			if (Status[QNum][3] < 0){Status[QNum][3] = 0;}
		}
	}

//Check whether the quiz is finished
	var Finished = true;
	for (var i=0; i<Status.length; i++){
		if (Status[i][0] == 0){Finished = false;}
	}

//Calculate the score if needed
		
	if (Status[QNum][0] == 1){
		if ((Finished==true)||(ContinuousScoring==true)){
			CalculateScore();
			Output = Output + '<br />' + YourScoreIs + ' ' + Score + '%.';
		}

		if (Finished == true){
			EraseFeedback = false;
			var CFT = 0;
			for (i=0; i<I.length; i++){
				if (Status[i][2] == 0){
					CFT++;
				}
			}
		Output += '<br />' + CorrectFirstTime + CFT + '/' + I.length;

		}
	}

//Show the feedback
	if (Output.length > 0){
		WriteFeedback(Output);
	}

}

function CheckAnswer(QNum, ANum){
	var Output = I[QNum][1][ANum][1];

	if (Output==''){
		if (I[QNum][1][ANum][2] == 1){
			Output = DefaultRight;
		}
		else{
			Output = DefaultWrong;
		}
	}

//If it's not been previously answered correctly
	if (Status[QNum][0] == 0){
//If it's a correct answer
		if (I[QNum][1][ANum][2] == 1){
			Status[QNum][0] = 1;//Mark the Q as done
			Status[QNum][1][ANum] = 'R';
			MarkAnswer(QNum, ANum, true);
//Calculate the score for this question as a floating-point fraction of 1
			var PossibleWrongs = 0;
			for (var i=0; i<I[QNum][1].length; i++){
				if (I[QNum][1][i][2] == 0){
					PossibleWrongs++;
				}
			}

			if (PossibleWrongs == 0){PossibleWrongs = 1;}

			Status[QNum][3] = 1 - (Status[QNum][2]/PossibleWrongs);

//If less than zero, set to zero
			if (Status[QNum][3] < 0){Status[QNum][3] = 0;}
		}
		else{
			if (Status[QNum][1][ANum] != 'W'){
				Status[QNum][1][ANum] = 'W';
				MarkAnswer(QNum, ANum, false);
				Status[QNum][2]++; //increment wrong tries for this Q
			}
		}
	}

	UpdateQuestionStatus(QNum);

//Check whether the quiz is finished
	var Finished = true;
	for (var i=0; i<Status.length; i++){
		if (Status[i][0] == 0){Finished = false;}

	}

//Calculate the score if needed
		
	if (Status[QNum][0] == 1){
		if ((Finished==true)||(ContinuousScoring==true)){
			CalculateScore();
			Output = Output + '<br />' + YourScoreIs + ' ' + Score + '%.';
		}

		if (Finished == true){
			EraseFeedback = false;
			var CFT = 0;
			for (i=0; i<I.length; i++){
				if (Status[i][2] == 0){
					CFT++;
				}
			}
		Output += '<br />' + CorrectFirstTime + CFT + '/' + I.length;

		}
	}

//Show the feedback
	if (Output.length > 0){
		WriteFeedback(Output);
	}
}

function CalculateScore(){
	var TriedQs = 0;
	var TotalScore = 0;
	for (var i=0; i<Status.length; i++){
		if ((Status[i][2] > 0)||(Status[i][3] == 1)){
			TriedQs++;
			TotalScore += Status[i][3];
		}
	}
	if (TriedQs == 0){
		Score = 0;
	}
	else{
		Score = (Math.floor(100 * (TotalScore/TriedQs)));
	}
}

function MarkAnswer(QNum, ANum, Right){
	var Mark = CorrectIndicator;
	if (Right == false){Mark = IncorrectIndicator;}

	if (eval('BottomFrame.document.QForm.FB_' + QNum + '_' + ANum) != null){
		eval('BottomFrame.document.QForm.FB_' + QNum + '_' + ANum).value = Mark;
	}
}

function CheckCheckbox(QNum, ANum){
	if (eval('BottomFrame.document.QForm.A_' + QNum + '_' + ANum) != null){
		eval('BottomFrame.document.QForm.A_' + QNum + '_' + ANum).checked = true;
	}
}







function Blank(){
	return '<html><body>&copy;Half-Baked Software. Loading...</body></html>';
}

//-->

//]]>


