

//<![CDATA[

<!--


function Client(){
//if not a DOM browser, hopeless
	this.min = false; if (document.getElementById){this.min = true;};

	this.ua = navigator.userAgent;
	this.name = navigator.appName;
	this.ver = navigator.appVersion;  

//Get data about the browser
	this.mac = (this.ver.indexOf('Mac') != -1);
	this.win = (this.ver.indexOf('Windows') != -1);

//Look for Gecko
	this.gecko = (this.ua.indexOf('Gecko') > 1);
	if (this.gecko){
		this.geckoVer = parseInt(this.ua.substring(this.ua.indexOf('Gecko')+6, this.ua.length));
		if (this.geckoVer < 20020000){this.min = false;}
	}
	
//Look for Firebird
	this.firebird = (this.ua.indexOf('Firebird') > 1);
	
//Look for Safari
	this.safari = (this.ua.indexOf('Safari') > 1);
	if (this.safari){
		this.gecko = false;
	}
	
//Look for IE
	this.ie = (this.ua.indexOf('MSIE') > 0);
	if (this.ie){
		this.ieVer = parseFloat(this.ua.substring(this.ua.indexOf('MSIE')+5, this.ua.length));
		if (this.ieVer < 5.5){this.min = false;}
	}
	
//Look for Opera
	this.opera = (this.ua.indexOf('Opera') > 0);
	if (this.opera){
		this.operaVer = parseFloat(this.ua.substring(this.ua.indexOf('Opera')+6, this.ua.length));
		if (this.operaVer < 7.04){this.min = false;}
	}
	if (this.min == false){
		alert('Your browser may not be able to handle this page.');
	}
	
//Special case for the horrible ie5mac
	this.ie5mac = (this.ie&&this.mac&&(this.ieVer<6));
}

var C = new Client();

//for (prop in C){
//	alert(prop + ': ' + C[prop]);
//}



//CODE FOR HANDLING NAV BUTTONS AND FUNCTION BUTTONS

//[strNavBarJS]
function NavBtnOver(Btn){
	if (Btn.className != 'NavButtonDown'){Btn.className = 'NavButtonUp';}
}

function NavBtnOut(Btn){
	Btn.className = 'NavButton';
}

function NavBtnDown(Btn){
	Btn.className = 'NavButtonDown';
}
//[/strNavBarJS]

function FuncBtnOver(Btn){
	if (Btn.className != 'FuncButtonDown'){Btn.className = 'FuncButtonUp';}
}

function FuncBtnOut(Btn){
	Btn.className = 'FuncButton';
}

function FuncBtnDown(Btn){
	Btn.className = 'FuncButtonDown';
}

function FocusAButton(){
	if (document.getElementById('CheckButton1') != null){
		document.getElementById('CheckButton1').focus();
	}
	else{
		if (document.getElementById('CheckButton2') != null){
			document.getElementById('CheckButton2').focus();
		}
		else{
			document.getElementsByTagName('button')[0].focus();
		}
	}
}




//CODE FOR HANDLING DISPLAY OF POPUP FEEDBACK BOX

var topZ = 1000;

function ShowMessage(Feedback){
	var Output = Feedback + '<br /><br />';
	document.getElementById('FeedbackContent').innerHTML = Output;
	var FDiv = document.getElementById('FeedbackDiv');
	topZ++;
	FDiv.style.zIndex = topZ;
	FDiv.style.top = TopSettingWithScrollOffset(30) + 'px';

	FDiv.style.display = 'block';

	ShowElements(false, 'input');
	ShowElements(false, 'select');
	ShowElements(false, 'object');

//Focus the OK button
	setTimeout("document.getElementById('FeedbackOKButton').focus()", 50);
	
//
}

function ShowElements(Show, TagName){
//Special for IE bug -- hide all the form elements that will show through the popup
	if (C.ie){
		var Els = document.getElementsByTagName(TagName);
		for (var i=0; i<Els.length; i++){
			if (Show == true){
				Els[i].style.display = 'inline';
			}
			else{
				Els[i].style.display = 'none';
			}
		}
	} 
}

function HideFeedback(){
	document.getElementById('FeedbackDiv').style.display = 'none';
	ShowElements(true, 'input');
	ShowElements(true, 'select');
	ShowElements(true, 'object');
	if (Finished == true){
		Finish();
	}
}


//GENERAL UTILITY FUNCTIONS AND VARIABLES

//PAGE DIMENSION FUNCTIONS
function PageDim(){
//Get the page width and height
	this.W = 600;
	this.H = 400;
	this.W = document.getElementsByTagName('body')[0].clientWidth;
	this.H = document.getElementsByTagName('body')[0].clientHeight;
}

var pg = null;

function GetPageXY(El) {
	var XY = {x: 0, y: 0};
	while(El){
		XY.x += El.offsetLeft;
		XY.y += El.offsetTop;
		El = El.offsetParent;
	}
	return XY;
}

function GetScrollTop(){
	if (document.documentElement && document.documentElement.scrollTop){
		return document.documentElement.scrollTop;
	}
	else{
		if (document.body){
 			return document.body.scrollTop;
		}
		else{
			return window.pageYOffset;
		}
	}
}

function GetViewportHeight(){
	if (window.innerHeight){
		return window.innerHeight;
	}
	else{
		return document.getElementsByTagName('body')[0].clientHeight;
	}
}

function TopSettingWithScrollOffset(TopPercent){
	var T = Math.floor(GetViewportHeight() * (TopPercent/100));
	return GetScrollTop() + T; 
}

//CODE FOR AVOIDING LOSS OF DATA WHEN BACKSPACE KEY INVOKES history.back()
var InTextBox = false;

function SuppressBackspace(e){ 
	if (InTextBox == true){return;}
	if (C.ie) {
		thisKey = window.event.keyCode;
	}
	else {
		thisKey = e.keyCode;
	}

	var Suppress = false;

	if (thisKey == 8) {
		Suppress = true;
	}

	if (Suppress == true){
		if (C.ie){
			window.event.returnValue = false;	
			window.event.cancelBubble = true;
		}
		else{
			e.preventDefault();
		}
	}
}

if (C.ie){
	document.attachEvent('onkeydown',SuppressBackspace);
	window.attachEvent('onkeydown',SuppressBackspace);
}
else{
	if (window.addEventListener){
		window.addEventListener('keypress',SuppressBackspace,false);
	}
}

function ReduceItems(InArray, ReduceToSize){
	var ItemToDump=0;
	var j=0;
	while (InArray.length > ReduceToSize){
		ItemToDump = Math.floor(InArray.length*Math.random());
		InArray.splice(ItemToDump, 1);
	}
}

function Shuffle(InArray){
	var Num;
	var 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-1); k++) {
			Temp[k] = Temp[k+1];
		}
		j--;
	}
	return InArray;
}

function WriteToInstructions(Feedback) {
	document.getElementById('InstructionsDiv').innerHTML = Feedback;

}




function EscapeDoubleQuotes(InString){
	return InString.replace(/"/g, '&quot;')
}

function TrimString(InString){
        var x = 0;

        if (InString.length != 0) {
                while ((InString.charAt(InString.length - 1) == '\u0020') || (InString.charAt(InString.length - 1) == '\u000A') || (InString.charAt(InString.length - 1) == '\u000D')){
                        InString = InString.substring(0, InString.length - 1)
                }

                while ((InString.charAt(0) == '\u0020') || (InString.charAt(0) == '\u000A') || (InString.charAt(0) == '\u000D')){
                        InString = InString.substring(1, InString.length)
                }

                while (InString.indexOf('  ') != -1) {
                        x = InString.indexOf('  ')
                        InString = InString.substring(0, x) + InString.substring(x+1, InString.length)
                 }

                return InString;
        }

        else {
                return '';
        }
}

function FindLongest(InArray){
	if (InArray.length < 1){return -1;}

	var Longest = 0;
	for (var i=1; i<InArray.length; i++){
		if (InArray[i].length > InArray[Longest].length){
			Longest = i;
		}
	}
	return Longest;
}

//UNICODE CHARACTER FUNCTIONS
function IsCombiningDiacritic(CharNum){
	var Result = (((CharNum >= 0x0300)&&(CharNum <= 0x370))||((CharNum >= 0x20d0)&&(CharNum <= 0x20ff)));
	Result = Result || (((CharNum >= 0x3099)&&(CharNum <= 0x309a))||((CharNum >= 0xfe20)&&(CharNum <= 0xfe23)));
	return Result;
}

function IsCJK(CharNum){
	return ((CharNum >= 0x3000)&&(CharNum < 0xd800));
}

//SETUP FUNCTIONS
//BROWSER WILL REFILL TEXT BOXES FROM CACHE IF NOT PREVENTED
function ClearTextBoxes(){
	var NList = document.getElementsByTagName('input');
	for (var i=0; i<NList.length; i++){
		if ((NList[i].id.indexOf('Guess') > -1)||(NList[i].id.indexOf('Gap') > -1)){
			NList[i].value = '';
		}
		if (NList[i].id.indexOf('Chk') > -1){
			NList[i].checked = '';
		}
	}
}

//EXTENSION TO ARRAY OBJECT
function Array_IndexOf(Input){
	var Result = -1;
	for (var i=0; i<this.length; i++){
		if (this[i] == Input){
			Result = i;
		}
	}
	return Result;
}
Array.prototype.indexOf = Array_IndexOf;

//IE HAS RENDERING BUG WITH BOTTOM NAVBAR
function RemoveBottomNavBarForIE(){
	if ((C.ie)&&(document.getElementById('Reading') != null)){
		if (document.getElementById('BottomNavBar') != null){
			document.getElementById('TheBody').removeChild(document.getElementById('BottomNavBar'));
		}
	}
}




//HOTPOTNET-RELATED CODE

var HPNStartTime = (new Date()).getTime();
var SubmissionTimeout = 30000;
var Detail = ''; //Global that is used to submit tracking data

function Finish(){
//If there's a form, fill it out and submit it
	if (document.store != null){
		Frm = document.store;
		Frm.starttime.value = HPNStartTime;
		Frm.endtime.value = (new Date()).getTime();
		Frm.mark.value = Score;
		Frm.detail.value = Detail;
		Frm.submit();
	}
}



//JQUIZ CORE JAVASCRIPT CODE

var CurrQNum = 0;
var CorrectIndicator = ':-)';
var IncorrectIndicator = 'X';
var YourScoreIs = 'Your score is ';
var ContinuousScoring = true;
var CorrectFirstTime = 'Questions answered correctly first time: ';
var ShowCorrectFirstTime = false;
var ShuffleQs = true;
var ShuffleAs = true;
var DefaultRight = 'Correct!';
var DefaultWrong = 'Sorry! Try again.';
var QsToShow = 10;
var Score = 0;
var Finished = false;
var Qs = null;
var QArray = new Array();
var ShowingAllQuestions = false;
var ShowAllQuestionsCaption = 'Show all questions';
var ShowOneByOneCaption = 'Show questions one by one';
var State = new Array();
var Feedback = '';
var TimeOver = false;
var strInstructions = '';

//The following variable can be used to add a message explaining that
//the question is finished, so no further marking will take place.
var strQuestionFinished = '';

function CompleteEmptyFeedback(){
	var QNum, ANum;
	for (QNum=0; QNum<I.length; QNum++){
//Only do this if not multi-select
		if (I[QNum][2] != '3'){
  		for (ANum = 0; ANum<I[QNum][3].length; ANum++){
  			if (I[QNum][3][ANum][1].length < 1){
  				if (I[QNum][3][ANum][2] > 0){
  					I[QNum][3][ANum][1] = DefaultRight;
  				}
  				else{
  					I[QNum][3][ANum][1] = DefaultWrong;
  				}
  			}
  		}
		}
	}
}

function SetUpQuestions(){
	var AList = new Array(); 
	var QList = new Array();
	var i, j;
	Qs = document.getElementById('Questions');
	while (Qs.getElementsByTagName('li').length > 0){
		QList.push(Qs.removeChild(Qs.getElementsByTagName('li')[0]));
	}
	var DumpItem = 0;
	if (QsToShow > QList.length){
		QsToShow = QList.length;
	}
	while (QsToShow < QList.length){
		DumpItem = Math.floor(QList.length*Math.random());
		for (j=DumpItem; j<(QList.length-1); j++){
			QList[j] = QList[j+1];
		}
		QList.length = QList.length-1;
	}
	if (ShuffleQs == true){
		QList = Shuffle(QList);
	}
	if (ShuffleAs == true){
		var As;
		for (var i=0; i<QList.length; i++){
			As = QList[i].getElementsByTagName('ol')[0];
			if (As != null){
  			AList.length = 0;
				while (As.getElementsByTagName('li').length > 0){
					AList.push(As.removeChild(As.getElementsByTagName('li')[0]));
				}
				AList = Shuffle(AList);
				for (j=0; j<AList.length; j++){
					As.appendChild(AList[j]);
				}
			}
		}
	}
	
	for (i=0; i<QList.length; i++){
		Qs.appendChild(QList[i]);
		QArray[QArray.length] = QList[i];
	}

//Show the first item
	QArray[0].style.display = '';
	
//Now hide all except the first item
	for (i=1; i<QArray.length; i++){
		QArray[i].style.display = 'none';
	}		
	SetQNumReadout();
}

function ChangeQ(ChangeBy){
//The following line prevents moving to another question until the current
//question is answered correctly. Uncomment it to enable this behaviour. 
//	if (State[CurrQNum][0] == -1){return;}
	if (((CurrQNum + ChangeBy) < 0)||((CurrQNum + ChangeBy) >= QArray.length)){return;}
	QArray[CurrQNum].style.display = 'none';
	CurrQNum += ChangeBy;
	QArray[CurrQNum].style.display = '';
	SetQNumReadout();
//if there's a textbox, set the focus in it
	if (QArray[CurrQNum].getElementsByTagName('input')[0] != null){
		QArray[CurrQNum].getElementsByTagName('input')[0].focus();
	}
}

function SetQNumReadout(){
	document.getElementById('QNumReadout').innerHTML = (CurrQNum+1) + ' / ' + QArray.length;
}

I=new Array();
I[0]=new Array();I[0][0]=100;
I[0][1]='';
I[0][2]='0';
I[0][3]=new Array();
I[0][3][0]=new Array('France and Spain','Correct!  Britain was able to do this mainly because of its superior naval strength.',1,100,1);
I[0][3][1]=new Array('Spain and Germany','Nope.  Britain and Germany were not adversaries in this war.',0,0,1);
I[0][3][2]=new Array('The United States and France','Sorry.  There was no such thing as the United States at this point in history.',0,0,1);
I[0][3][3]=new Array('Germany and France','Nope.  Britain and Germany were not adversaries in this war.',0,0,1);
I[0][3][4]=new Array('England and France','Sorry.  England and Britain are the same thing.',0,0,1);
I[1]=new Array();I[1][0]=100;
I[1][1]='';
I[1][2]='0';
I[1][3]=new Array();
I[1][3][0]=new Array('To raise money to help pay off the debts built up during the French and Indian Wars.','Right!  The feeling was that the American colonies had not paid their financial share to help finance their defense during the  French & Indian Wars.',1,100,1);
I[1][3][1]=new Array('To punish the colonies for their lack of support during the French and Indian Wars.','Sorry.  The colonies had supported the British during the war with manpower and supplies.',0,0,1);
I[1][3][2]=new Array('Because of a misunderstanding as to the amount of wealth in the colonies.','Sorry.  It was well-known that there was wealth in the colonies, and this was true.',0,0,1);
I[1][3][3]=new Array('To ensure that the colonies did not become too rich and independent.','Nope.  While there was a desire to ensure they didn\'t become too independent, this wasn\u2019t the reason the taxes were placed on the colonies following the war.',0,0,1);
I[1][3][4]=new Array('The British Parliament did not increase taxes on the American colonies.','Nope.  They did indeed raise taxes, and this was the very thing that led to the American Revolution.,',0,0,1);
I[2]=new Array();I[2][0]=100;
I[2][1]='';
I[2][2]='0';
I[2][3]=new Array();
I[2][3][0]=new Array('The "Boston Massacre". ','Sorry.  This event occurred earlier,  in 1770.',0,0,1);
I[2][3][1]=new Array('The "Boston Tea Party".','Excellent!  Bostonians disguised as warlike Indians boarded a merchant ship and dumped some British tea into the harbor rather than pay taxes due on it.',1,100,1);
I[2][3][2]=new Array('The "Coercive Acts".','Nope.  England responded with the Coercive Acts because of this incident.',0,0,1);
I[2][3][3]=new Array('The Stamp Act was enacted by the British Parliament.','Nope.  This occurred the previous decade.',0,0,1);
I[2][3][4]=new Array('The battle of Lexington.','Sorry.  This battle took place well afterwards, during the Revolution.',0,0,1);
I[3]=new Array();I[3][0]=100;
I[3][1]='';
I[3][2]='0';
I[3][3]=new Array();
I[3][3][0]=new Array('To the Treaty of Paris.','Sorry.  This treaty ended the American Revolution and wouldn\'t come until much later.',0,0,1);
I[3][3][1]=new Array('To the "Boston Massacre". ','Sorry.  This happened a few years before.',0,0,1);
I[3][3][2]=new Array('To the "Coercive Acts".','Correct.  These Acts were enacted right after the Boston Tea Party and closed the port of Boston.',1,100,1);
I[3][3][3]=new Array('To the Stamp Act.','Nope.  This Act was in place well before the Boston Tea Party.',0,0,1);
I[3][3][4]=new Array('To the Townsend Act.','Nope.  This Act was in place well before the Boston Tea Party.',0,0,1);
I[4]=new Array();I[4][0]=100;
I[4][1]='';
I[4][2]='0';
I[4][3]=new Array();
I[4][3][0]=new Array('Tar, pitch, turpentine, and timber. ','Right.  These important shipbuilding materials were of vital importance to the British Navy.',1,100,1);
I[4][3][1]=new Array('Iron, coal and canvas.','Nope.  These were three things the British did not need to turn to the colonies for.',0,0,1);
I[4][3][2]=new Array('Timber, coal and canvas.','Sorry.  The British did not need to turn to the colonies for canvas.',0,0,1);
I[4][3][3]=new Array('Tar, timber and coal.','Sorry.  The British did not need to turn to the colonies for coal.',0,0,1);
I[4][3][4]=new Array('Iron, timber and pitch.','Nope.  The British had other sources for iron.',0,0,1);
I[5]=new Array();I[5][0]=100;
I[5][1]='';
I[5][2]='0';
I[5][3]=new Array();
I[5][3][0]=new Array('November 10th, 1775','Excellent.  Two battalions of Marines were established on this date.',1,100,1);
I[5][3][1]=new Array('October 13th, 1775','Sorry.  This was the date that the Continental Congress took the step that the U.S. navy regards as its official birth.',0,0,1);
I[5][3][2]=new Array('April 14th, 1777','Nope.  The Marine Corps was established and operating well prior to this.',0,0,1);
I[5][3][3]=new Array('November 10th, 1776','Nope.  The Marine Corps was established and operating well prior to this.',0,0,1);
I[5][3][4]=new Array('October 13th, 1777','Sorry.  October 13th is the Navy\'s birthday, not the Marines, and it came in 1775, not 1777.',0,0,1);
I[6]=new Array();I[6][0]=100;
I[6][1]='';
I[6][2]='0';
I[6][3]=new Array();
I[6][3][0]=new Array('There wasn\'t a problem recruiting crews early on in the Revolution.','Correct!  Men were eager to join and serve in the Navy in the early years of the war.',1,100,1);
I[6][3][1]=new Array('Stricter discipline and low pay.','Nope.  This would come later, but was not the case in the early Continental Navy.',0,0,1);
I[6][3][2]=new Array('Not enough manpower in the colonies.','Sorry.  There was more than enough willing manpower in the colonies at the start of the war.',0,0,1);
I[6][3][3]=new Array('The lack of a seafaring tradition in the colonies meant that not many men were ready to become sailors.','Nope.  The colonies has a rich seafaring tradition and many sailors.',0,0,1);
I[6][3][4]=new Array('The lack of a professional recruiting force.','Sorry.  There was no lack of recruiters, and they were fairly successful.',0,0,1);
I[7]=new Array();I[7][0]=100;
I[7][1]='';
I[7][2]='0';
I[7][3]=new Array();
I[7][3][0]=new Array('The American force failed to take Quebec  and retreated back into colonial territory.','Right!  The attack against Quebec in the fall of 1775 failed, and General Arnold had to withdraw back into the colonies.',1,100,1);
I[7][3][1]=new Array('The American force took Quebec, but was forced to retreat back to colonial territory later.','Nope.  Despite a good effort, the Americans failed to take Quebec.',0,0,1);
I[7][3][2]=new Array('The American Force took Canada and remained in control of Canada throughout the war.','Nope.  The U.S. did not control Candida throughout the war.',0,0,1);
I[7][3][3]=new Array('The Americans never did invade Canada.','Sorry.  There was an invasion of Canada early on it the war in an attempt to prevent the British staging out of there.',0,0,1);
I[7][3][4]=new Array('The American force beat a superior British force, took the city of Quebec and then returned to the colonies.','Sorry.  While they did indeed return to the colonies, they did not do so victorious.',0,0,1);
I[8]=new Array();I[8][0]=100;
I[8][1]='';
I[8][2]='0';
I[8][3]=new Array();
I[8][3][0]=new Array('General Benedict Arnold ','Excellent!  Although Arnold\'s action in this battle could not be considered a "victory" in the usual sense, because he had lost all his ships, the Patriots were able to stop the southerly British advance and gain time to regroup and train their forces until the following spring.',1,100,1);
I[8][3][1]=new Array('General John Burgoyne','Nope.  General Burgoyne was one of the two British commanders at this engagement.',0,0,1);
I[8][3][2]=new Array('General Sir Guy Carleton ','Nope.  General Sir Guy Carleton was one of the two British commanders at this engagement.',0,0,1);
I[8][3][3]=new Array('Captain John Paul Jones','Sorry.  John Paul Jones did his fighting on the open ocean, not on Lake Champlain.',0,0,1);
I[8][3][4]=new Array('General George Washington','Sorry.  The northern expedition and its movement and action while returning to the colonies was not controlled by General Washington.',0,0,1);
I[9]=new Array();I[9][0]=100;
I[9][1]='';
I[9][2]='0';
I[9][3]=new Array();
I[9][3][0]=new Array('The Patriots were able to stop the southerly British advance.','Correct.  Even though they had lost all of their ships, the Patriots inflicted enough damage on the British fleet that they were forced to return to Canada for the winter.',1,100,1);
I[9][3][1]=new Array('The American Forces were able to take the City of Quebec.','Nope.  The Americans did not go back to Canada after this engagement.',0,0,1);
I[9][3][2]=new Array('The British Fleet was destroyed and unable to sail again on Lake Champlain.','Sorry.  While the British Fleet did suffer heavy losses, they were not destroyed.',0,0,1);
I[9][3][3]=new Array('The British Fleet was unable to resupply the British Army trapped in New York.','Nope.  There was no British Army trapped in New York at this point in the war.',0,0,1);
I[9][3][4]=new Array('The French Navy was able to stop the British invasion of New York.','Sorry.  The French Navy did not participate in the first Battle of  Lake Champlain.',0,0,1);
I[10]=new Array();I[10][0]=100;
I[10][1]='';
I[10][2]='0';
I[10][3]=new Array();
I[10][3][0]=new Array('To use a three-pronged attack on Albany, New York to split the colonies in half.','Right.  Dividing the colonies was seen as the way to quickly bring the war to an end.',1,100,1);
I[10][3][1]=new Array('To attack from their base in New York to capture Boston, then Philadelphia.','Nope.  While Philadelphia did wind up following to the British, it was not a part of the plan and delayed the goals of the plan long enough for the Patriots to rally and defeat Burgoyne at Saratoga.',0,0,1);
I[10][3][2]=new Array('To occupy the major colonial cities and starve out Washington\'s Army.','Sorry.  While the ultimate goal was to render Washington\'s Army useless, this wasn\'t to be accomplished by taking only the larger cities.',0,0,1);
I[10][3][3]=new Array('To lure Washington\'s Army out into the open and defeat it in a major battle.','Sorry.  The British knew that Washington would not engage his Army against the strength of the British at this time.',0,0,1);
I[10][3][4]=new Array('To burn all farms and seaports to deny the Patriots resupply.','Nope.  The British did not pursue a "scorched Earth" policy at this point in the war.',0,0,1);
I[11]=new Array();I[11][0]=100;
I[11][1]='';
I[11][2]='0';
I[11][3]=new Array();
I[11][3][0]=new Array('Because the American victory at Saratoga brought the French into the war on the American side. ','Excellent.  This proved to the French that the Patriots had a chance in defeating the British.  It was this victory that convinced the French to provide direct aid to the American cause.',1,100,1);
I[11][3][1]=new Array('Because it delayed the British Forces long enough for Washington\'s Army to ready their defense of Boston.','Nope.  The defense of Boston would not come until much later.',0,0,1);
I[11][3][2]=new Array('Because it was the first successful Naval Battle of the Revolution for the Americans.','Nope.  The Americans had several minor victories prior to this and Saratoga was not a Naval Battle.',0,0,1);
I[11][3][3]=new Array('Because the native Indian tribes gave their support to the patriots after this battle.','Sorry.  This never happened.  Some tribes favored the British and some favored the Patriots.  Overall, there was far less participation than there had been during the French & Indian Wars.',0,0,1);
I[11][3][4]=new Array('Because it resulted in the surrender of all British forces in the Americas.','Sorry.  While Burgoyne\'s Army did surrender, it was only a small part of the British Army in America.',0,0,1);
I[12]=new Array();I[12][0]=100;
I[12][1]='';
I[12][2]='0';
I[12][3]=new Array();
I[12][3][0]=new Array('Benjamin Franklin ','Correct!  An accomplished man in many regards, many think that it was as a diplomat in France that Franklin gave his greatest service to America.',1,100,1);
I[12][3][1]=new Array('Thomas Jefferson','Nope.  Jefferson was not in France during this period.',0,0,1);
I[12][3][2]=new Array('Samuel Adams','Nope.  Samuel Adams was in Boston at this time.',0,0,1);
I[12][3][3]=new Array('George Washington','Sorry.  Washington was rather busy being in charge of the Continental Army.',0,0,1);
I[12][3][4]=new Array('Alexander Hamilton','Sorry.  While Hamilton would later prove an accomplished diplomat, he was not the one in France at this time.',0,0,1);
I[13]=new Array();I[13][0]=100;
I[13][1]='';
I[13][2]='0';
I[13][3]=new Array();
I[13][3][0]=new Array('Captain John Paul Jones','Right!  As the inscription on his tomb reads, "He gave to our Navy its earliest traditions of heroism and victory."',1,100,1);
I[13][3][1]=new Array('Captain Richard Pearson','Nope.  Captain Pearson was the British Captain in charge of the HMS Serapis in its famous battle against Jones.',0,0,1);
I[13][3][2]=new Array('Admiral Nathaniel Greene','Nope.  Nathaniel Green was an American General, not a Naval Admiral.',0,0,1);
I[13][3][3]=new Array('Captain John Jay','Sorry.  Jay was one of the primary American diplomats that negotiated the treaty ending the war in 1783.',0,0,1);
I[13][3][4]=new Array('Admiral de Grasse','Sorry.  Admiral de Grasse was the French Admiral that helped Washington win the decisive battle of Yorktown in 1781.',0,0,1);
I[14]=new Array();I[14][0]=100;
I[14][1]='';
I[14][2]='0';
I[14][3]=new Array();
I[14][3][0]=new Array('Off the northeast coast of England.','Excellent!  Many think to this day that the battle was fought off the U.S. East Coast, but it was indeed off the northeast coast of England, where Jones\' ship had been raiding.',1,100,1);
I[14][3][1]=new Array('Just outside of Boston Harbor.','Nope.  It was quite a bit farther out than that.',0,0,1);
I[14][3][2]=new Array('Off the coast of New York.','Sorry.  Jones took the battle to the English, rather than remain in the waters off of the U.S. coast.',0,0,1);
I[14][3][3]=new Array('In the North Atlantic off Nova Scotia.','Sorry.  While there were engagements in this area as it was an important port for the British, this wasn\'t where this particular engagement took place.',0,0,1);
I[14][3][4]=new Array('Off of the French coast.','Nope.  While American ships did sail in these waters during the war, this wasn\'t the site of this famous engagement.',0,0,1);
I[15]=new Array();I[15][0]=100;
I[15][1]='';
I[15][2]='0';
I[15][3]=new Array();
I[15][3][0]=new Array('The Bonhomme Richard.','Correct.  Jones had named the ship this name in honor of Benjamin Franklin, who had written Poor Richard\'s Almanac.',1,100,1);
I[15][3][1]=new Array('The Ranger.','Sorry.  It had once been named the Ranger, but it had been renamed by the time of the battle.',0,0,1);
I[15][3][2]=new Array('The Constitution.','Sorry.  The Constitution would not be built until 1796.',0,0,1);
I[15][3][3]=new Array('The Enterprise.','Nope.  There was no USS Enterprise at this time in the U.S. Navy.',0,0,1);
I[15][3][4]=new Array('The Constellation.','Sorry.  The Constellation would not be built until 1797.',0,0,1);
I[16]=new Array();I[16][0]=100;
I[16][1]='';
I[16][2]='0';
I[16][3]=new Array();
I[16][3][0]=new Array('A naval battle between the French and English Fleets off the Virginia Capes.','Right.  This action prevented the evacuation of the British forces.',1,100,1);
I[16][3][1]=new Array('The second Battle of Lake Champlain.','Nope.  This would not occur until much later.',0,0,1);
I[16][3][2]=new Array('The first Battle of Lake Champlain.','Sorry.  This occurred at the opening of the war.',0,0,1);
I[16][3][3]=new Array('The Naval Battle of Hampton Roads.','Sorry.  This was an important naval engagement of the Civil War, not the Revolutionary War.',0,0,1);
I[16][3][4]=new Array('The Naval Battle of Lexington.','Nope.  The battle of Lexington was a land battle that happened early in the Revolutionary War.',0,0,1);
I[17]=new Array();I[17][0]=100;
I[17][1]='';
I[17][2]='0';
I[17][3]=new Array();
I[17][3][0]=new Array('The West Indies, the Mediterranean, and India. ','Excellent.  These areas and the prize of the sugar trade were the real points of interest for France and Britain at this time.',1,100,1);
I[17][3][1]=new Array('France, Spain, and the Netherlands.','Nope.  Spain did not play a role in this war.',0,0,1);
I[17][3][2]=new Array('The Dutch East Indies and South Carolina.','Sorry.  The British had lost South Carolina by this point in the war.',0,0,1);
I[17][3][3]=new Array('Portugal, Spain and France.','Nope.  Spain did not play a role in this war.',0,0,1);
I[17][3][4]=new Array('The western American colonies and Canada.','Sorry.  Canada only saw a part in the Revolutionary War early on, when the Americans tried unsuccessfully to invade.',0,0,1);
I[18]=new Array();I[18][0]=100;
I[18][1]='';
I[18][2]='0';
I[18][3]=new Array();
I[18][3][0]=new Array('3 September 1783','Correct!  This was the date that the Peace of Paris was signed between diplomatic delegations of the three countries involved.',1,100,1);
I[18][3][1]=new Array('4 July, 1776','Nope.  While we celebrate this as Independence Day, it wasn\'t until much later that the war was officially over.',0,0,1);
I[18][3][2]=new Array('23 August, 1781','Nope.  This was the date the British Army surrendered at Yorktown.  While this was a major defeat for the British, it wouldn\'t be until much later that the war officially ended.',0,0,1);
I[18][3][3]=new Array('May 19th, 1800','Sorry.  The Revolutionary War had been over for quite some time by 1800.',0,0,1);
I[18][3][4]=new Array('January 21st, 1785','Sorry.  By 1785 the war was over and the United States was its own country.',0,0,1);
I[19]=new Array();I[19][0]=100;
I[19][1]='';
I[19][2]='0';
I[19][3]=new Array();
I[19][3][0]=new Array('Boston','Right!  It was, in fact, called the Boston Massacre. ',1,100,1);
I[19][3][1]=new Array('Philadelphia','Sorry.  While Philadelphia was also a hotbed of revolution, this incident did not occur there.',0,0,1);
I[19][3][2]=new Array('Yorktown','Sorry.  Yorktown was a relatively quiet sea town at this point.  It would become very important 13 years later.',0,0,1);
I[19][3][3]=new Array('New York','Nope.  New York resented the taxation, but this was not the site of this massacre.',0,0,1);
I[19][3][4]=new Array('Saratoga','Nope.  Saratoga would later become the site of the first significant American victory, but it was not the site of this massacre.',0,0,1);
I[20]=new Array();I[20][0]=100;
I[20][1]='';
I[20][2]='0';
I[20][3]=new Array();
I[20][3][0]=new Array('Maine','Excellent.  This was considered to be the first real sea-fight of the war.',1,100,1);
I[20][3][1]=new Array('North Carolina','Nope.  It was much farther north than this.',0,0,1);
I[20][3][2]=new Array('Georgia','Nope.  It was much farther north than this.',0,0,1);
I[20][3][3]=new Array('Virginia','Sorry.  Good guess.  Virginia had a larger population at this point and more than a few woodsmen, but they were not from Virginia.',0,0,1);
I[20][3][4]=new Array('Rhode Island','Sorry.  While known for its sailors, Rhode Island was not known for its woodsmen.',0,0,1);
I[21]=new Array();I[21][0]=100;
I[21][1]='';
I[21][2]='0';
I[21][3]=new Array();
I[21][3][0]=new Array('October 13th, 1775','Correct!  This was the date the Congress approved a plan for buying, fitting out and arming two vessels. ',1,100,1);
I[21][3][1]=new Array('November 10th, 1775','Sorry.  This is the birthdate of the Marine Corps.',0,0,1);
I[21][3][2]=new Array('October 10th, 1775','Nope.  You are close, but you have your days mixed up with the Marine Corps birthday.',0,0,1);
I[21][3][3]=new Array('November 13th, 1775','Nope.  You are close, but you have your months mixed up with the Marine Corps birthday.',0,0,1);
I[21][3][4]=new Array('August 17th, 1776','Sorry.  The U.S. Navy was already established by this time, and August of 1776 would see Captain John Paul Jones capturing 16 enemy vessels and destroying many others.',0,0,1);
I[22]=new Array();I[22][0]=100;
I[22][1]='';
I[22][2]='0';
I[22][3]=new Array();
I[22][3][0]=new Array('The Ranger','Right!  The USS Ranger would come later in the war after being built by the French.',1,100,1);
I[22][3][1]=new Array('The Andrew Doria','Sorry.  The Andrew Doria had already been built, but was fitted out and armed at this time.',0,0,1);
I[22][3][2]=new Array('The Cabot','Sorry.  The Cabot  had already been built, but was fitted out and armed at this time.',0,0,1);
I[22][3][3]=new Array('The Alfred','Nope.  The Alfred was one of the two larger ships authorized to be built by the Congress.',0,0,1);
I[22][3][4]=new Array('','Nope.  The Columbus was one of the two larger ships authorized to be built by the Congress.',0,0,1);
I[23]=new Array();I[23][0]=100;
I[23][1]='';
I[23][2]='0';
I[23][3]=new Array();
I[23][3][0]=new Array('To put a fighting force on ships.','Excellent!  They were the sharpshooters and the naval infantry of the day.',1,100,1);
I[23][3][1]=new Array('To protect the important papers warships often carried.','Sorry.  They did not do courier duty in those days.',0,0,1);
I[23][3][2]=new Array('To have a force available to land and take enemy forts.','Sorry.  While Marines did take part in these type of actions, so did the regular sailors on the ship.',0,0,1);
I[23][3][3]=new Array('To protect Navy Captains from their crews.','Nope.  While security of the ship was a job of the Marines, this was not the main reason for their establishment.',0,0,1);
I[23][3][4]=new Array('To add pride and esprit de corps to the Navy.','Nope.  The Navy had plenty of its own during this early part of their history.',0,0,1);
I[24]=new Array();I[24][0]=100;
I[24][1]='';
I[24][2]='0';
I[24][3]=new Array();
I[24][3][0]=new Array('Esek Hopkins','Correct.  In his first command Hopkins was able to overcome two British forts and take more than eighty artillery pieces, powder and naval stores.',1,100,1);
I[24][3][1]=new Array('John Jay','Nope.  Jay was an important American diplomat who play a role in the agreement ending the war.',0,0,1);
I[24][3][2]=new Array('John Paul Jones','Nope.  While Jones was a part of this Squadron as a senior lieutenant on the USS Alfred, he was not the Squadron commander.',0,0,1);
I[24][3][3]=new Array('Benedict Arnold','Sorry.  Arnold was one of the leading Generals in the Continental Army at this point.',0,0,1);
I[24][3][4]=new Array('Andrew Doria','Sorry.  This was the name of one of the ships in the Squadron.',0,0,1);
I[25]=new Array();I[25][0]=100;
I[25][1]='';
I[25][2]='0';
I[25][3]=new Array();
I[25][3][0]=new Array('July 4th, 1776','Right.  This was announced by the Continental Congress in Philadelphia.',1,100,1);
I[25][3][1]=new Array('October 13th, 1775','Sorry.  This is the date that the U.S. Navy celebrates as its birthday.',0,0,1);
I[25][3][2]=new Array('November 10th, 1775','Sorry.  This is the date that the U.S. Marine Corps celebrates as its birthday.',0,0,1);
I[25][3][3]=new Array('September 3rd, 1783','Nope.  This was the date that the Treaty of Paris was signed, ending the Revolutionary War.',0,0,1);
I[25][3][4]=new Array('11 April, 1783','Nope.  This was the date that the U.S. Congress declared that the Revolutionary War was over.',0,0,1);
I[26]=new Array();I[26][0]=100;
I[26][1]='';
I[26][2]='0';
I[26][3]=new Array();
I[26][3][0]=new Array('Albany','Excellent.  General Howe\'s action put General Burgoyne\'s forces in a desperate position that resulted in their defeat at Saratoga.',1,100,1);
I[26][3][1]=new Array('Saratoga','Nope.  Saratoga is remembered because this is where General Burgoyne\'s forces would be defeated the following summer.',0,0,1);
I[26][3][2]=new Array('Boston','Nope.  Boston was not a part of the British plan.',0,0,1);
I[26][3][3]=new Array('New York','Sorry.  General Howe\'s forces were stationed in New York city.  This is where they moved out from during this operation.',0,0,1);
I[26][3][4]=new Array('Charleston','Sorry.  This entire operation took place in the northeast, not the southeast.',0,0,1);
I[27]=new Array();I[27][0]=100;
I[27][1]='';
I[27][2]='0';
I[27][3]=new Array();
I[27][3][0]=new Array('Saratoga','Correct!  Because General Howe had not linked up with General Burgoyne\'s forces as planned, General Burgoyne found himself surrounded and defeated at Saratoga.',1,100,1);
I[27][3][1]=new Array('Philadelphia','Nope.  General Howe\'s forces had already taken Philadelphia by this point.',0,0,1);
I[27][3][2]=new Array('Boston','Nope.  This action was not fought around Boston.',0,0,1);
I[27][3][3]=new Array('New York','Sorry.  New York remained firmly in British control during this time.',0,0,1);
I[27][3][4]=new Array('Yorktown','Sorry.  While Yorktown would be the site of a more significant defeat and surrender of a British Army later in the war, this was not where General Burgoyne surrendered his army in October of 1777.',0,0,1);
I[28]=new Array();I[28][0]=100;
I[28][1]='';
I[28][2]='0';
I[28][3]=new Array();
I[28][3][0]=new Array('"I\'ve not yet begun to fight!"','Right!  This famous quote came at the lowest point in the Bonhomme Richard and the British frigate HMS Serapis.',1,100,1);
I[28][3][1]=new Array('"Damn the torpedoes, full speed ahead!"','Nope.  This would be a famous quote of Admiral Farragut during the battle of Mobile Bay in the Civil War.',0,0,1);
I[28][3][2]=new Array('"You may fire when ready, Gridley"','Nope.  This famous quote came from Admiral Dewey during the Battle of Manila Bay during the Spanish-American War.',0,0,1);
I[28][3][3]=new Array('"Give me liberty or give me death"','Sorry.  Right war, wrong man.  This quote came from Patrick Henry during the Revolutionary War.',0,0,1);
I[28][3][4]=new Array('"Have you struck your colors?"','Sorry.  These were the word spoken to Jones by Captain Person of the HMS Serapis, asking Jones if he intended to surrender.',0,0,1);
I[29]=new Array();I[29][0]=100;
I[29][1]='';
I[29][2]='0';
I[29][3]=new Array();
I[29][3][0]=new Array('General Clinton','Excellent!  His first action was to abandon Philadelphia and move his army through New Jersey to reinforce New York City.',1,100,1);
I[29][3][1]=new Array('General Arnold','Nope.  By this time in the war Arnold had been exposed as a traitor to the American cause and had become a minor officer in the British Army.',0,0,1);
I[29][3][2]=new Array('General Cornwallis','Sorry.  General Cornwallis came into the colonies at the same time as the overall commander, but Cornwallis was only given command of the operations in the south, not the overall operations in America.',0,0,1);
I[29][3][3]=new Array('General Tarleton','Nope.  Tarleton was in charge of a British force that was destroyed at Cowpens in South Carolina by General Morgan Army.',0,0,1);
I[29][3][4]=new Array('General Morgan','Sorry.  General Morgan was an American General.  His Army was in the southern colonies.',0,0,1);
I[30]=new Array();I[30][0]=100;
I[30][1]='';
I[30][2]='0';
I[30][3]=new Array();
I[30][3][0]=new Array('Yorktown','Correct.  Cut off from reinforcements and the possibility of retreat by the sea through the actions of the French Fleet, Cornwallis was forced to surrender his Army to Washington.',1,100,1);
I[30][3][1]=new Array('Saratoga','Nope.  The key battle of Saratoga had happened much earlier in the war.',0,0,1);
I[30][3][2]=new Array('New York','Nope.  New York remained in British hands throughout the war and was the primary British base during the war.',0,0,1);
I[30][3][3]=new Array('Boston','Sorry.  Boston was not the site of this action.',0,0,1);
I[30][3][4]=new Array('Philadelphia','Sorry.  Philadelphia had long since been abandoned by the British and was firmly in American hands well before this action.',0,0,1);
I[31]=new Array();I[31][0]=100;
I[31][1]='';
I[31][2]='0';
I[31][3]=new Array();
I[31][3][0]=new Array('8 days','Right.  French and American troops, aided by the French Fleet, attacked for 8 days, capturing 2 key British positions and preventing the British from retreating across the York River to Gloucester.',1,100,1);
I[31][3][1]=new Array('10 days','Sorry.  It might have seemed more like 10 days, but it wasn\'t that long',0,0,1);
I[31][3][2]=new Array('2 months','Nope.  Had the battle dragged out this long, reinforcements from New York may well have turned the tide of the battle to the British favor.',0,0,1);
I[31][3][3]=new Array('1 week','Sorry.  You are close, but it didn\'t happen this quickly.',0,0,1);
I[31][3][4]=new Array('3 days','Nope.  The battle lasted much longer than three days.',0,0,1);
I[32]=new Array();I[32][0]=100;
I[32][1]='';
I[32][2]='0';
I[32][3]=new Array();
I[32][3][0]=new Array('The Peace of Paris','Excellent.  Benjamin Franklin, John Jay and John Adams represented the United States at this treaty signing.',1,100,1);
I[32][3][1]=new Array('The Treaty of London','Nope.  London was neither the site nor the name of this treaty ending the American Revolution.',0,0,1);
I[32][3][2]=new Array('The 7 Years Peace','Nope.  You may be thinking of the 7 Years War, as the French & Indian Wars was sometimes called, but this wasn\'t the name of the treaty ending the American Revolution.',0,0,1);
I[32][3][3]=new Array('The Surrender of Yorktown','Sorry.  While the surrender of General Cornwallis\' Army at Yorktown paved the way for this treaty, it wasn\'t the name of the treaty itself.',0,0,1);
I[32][3][4]=new Array('The Treaty of Lourdes','Sorry.  There was no Treaty of Lourdes related to the American Revolution.',0,0,1);
I[33]=new Array();I[33][0]=100;
I[33][1]='';
I[33][2]='0';
I[33][3]=new Array();
I[33][3][0]=new Array('John Jay','Correct!  Unlike today, these diplomats did not have the luxury of instant communications with Congress, and so had to negotiate and decide on things as they happened.',1,100,1);
I[33][3][1]=new Array('John Paul Jones','Nope.  Jones played his role on the open seas with the Continental Navy.',0,0,1);
I[33][3][2]=new Array('Benedict Arnold','Nope.  By this time Arnold had been exposed as a traitor to the colonies and was a minor British officer.',0,0,1);
I[33][3][3]=new Array('Esek Hopkins','Sorry.  Hopkins was the first Commander of a Continental Naval Squadron.',0,0,1);
I[33][3][4]=new Array('Thomas Jefferson','Sorry.  While Thomas Jefferson was an accomplished diplomat, his services were with the Continental Congress during this period.',0,0,1);
I[34]=new Array();I[34][0]=100;
I[34][1]='';
I[34][2]='0';
I[34][3]=new Array();
I[34][3][0]=new Array('Princeton','Right!  The British did not think that Washington\'s Army was capable of such actions and had not prepared adequately.',1,100,1);
I[34][3][1]=new Array('Saratoga','Sorry.  The American victory at Saratoga would come later, and it would be credited to Major General Horatio Gates.',0,0,1);
I[34][3][2]=new Array('Yorktown','Sorry.  The surrender of a British Army to Washington at Yorktown would come much later in the war.',0,0,1);
I[34][3][3]=new Array('Charleston','Nope.  Washington did not lead an army in the southern colonies.',0,0,1);
I[34][3][4]=new Array('Boston','Nope.  While Boston would be the site of a later battle, it was not the place chosen by Washington for a second surprise attack against the British.',0,0,1);
I[35]=new Array();I[35][0]=100;
I[35][1]='';
I[35][2]='0';
I[35][3]=new Array();
I[35][3][0]=new Array('They thought it would be powerless against the British Fleet and that the "Costal Cavalry" was enough.','Excellent!  The British Navy was extremely large, well-equipped and the undisputed masters of the sea.  It was hard to imagine that the colonies could do more than coastal defense against them.',1,100,1);
I[35][3][1]=new Array('Because there wouldn\'t be enough enlisted sailors to man the ships.','Nope.  There were more than enough men willing to join the Navy early in the war.',0,0,1);
I[35][3][2]=new Array('Because there weren\'t enough trained officers to command the ships.','Nope.  There was no lack of men trained as sea captains and even former British Naval Officers who would fight for the colonies.',0,0,1);
I[35][3][3]=new Array('Because not all of the colonies agreed to the need for a Navy.','Sorry.  It is true that not all of the colonies agreed to the need for a Navy, but this was not the main reason Congress was reluctant to form the Navy early in the war.',0,0,1);
I[35][3][4]=new Array('Because Congress believed that Naval Forces would not play a significant role in the fighting.','Sorry.  Congress knew that Britain would need to resupply and equip its forces over the ocean, and impeding this flow of men and supplies would be of vital importance to the outcome of the war.',0,0,1);
I[36]=new Array();I[36][0]=100;
I[36][1]='';
I[36][2]='0';
I[36][3]=new Array();
I[36][3][0]=new Array('The Battle of Saratoga.','Correct.  Saratoga proved to the French that the colonial forces had a chance against the British.',1,100,1);
I[36][3][1]=new Array('The Battle of Yorktown.','Sorry.  The battle of Yorktown was the final major blow to the British in America, not the first.',0,0,1);
I[36][3][2]=new Array('The Battle of Lake Champlain.','Sorry.  The first Battle of Lake Champlain was more of a draw, as General Arnold lost all of his ships, but it did delay the British forces enough to cause them to move back in to Canada.  It wasn\'t a significant event in the eyes of the French to bring them into the war.',0,0,1);
I[36][3][3]=new Array('The French victory during the Seven Years War.','Nope.  The French lost to the British in this war, fought in the years before the American Revolution.',0,0,1);
I[36][3][4]=new Array('The invasion of Canada by American forces.','Nope.  Had the American forces been successful in this invasion, it may well have brought the French in at this time.  The American forces were defeated however, and returned to the colonies.',0,0,1);
I[37]=new Array();I[37][0]=100;
I[37][1]='';
I[37][2]='0';
I[37][3]=new Array();
I[37][3][0]=new Array('Impressment','Right.  Impressment was a common tactic in recruiting during this period of history.',1,100,1);
I[37][3][1]=new Array('Detention','Sorry.  While they were, in effect, being detained at sea, this isn\'t the term used to describe this practice.',0,0,1);
I[37][3][2]=new Array('Imprisonment','Sorry.  Sailors obtained this way were not imprisoned, but instead forced to work as a sailor in the Navy.  They were generally paid as other sailors were.',0,0,1);
I[37][3][3]=new Array('Broadside','Nope.  A broadside is the simultaneous firing of all the main battery guns on one side of a warship.',0,0,1);
I[37][3][4]=new Array('Entrapment','Nope.  While this might seem like a form of entrapment, this wasn\'t the term used to describe this method of forced labor.',0,0,1);


function StartUp(){
	RemoveBottomNavBarForIE();

//If there's only one question, no need for question navigation controls
	if (QsToShow < 2){
		document.getElementById('QNav').style.display = 'none';
	}
	
//Stash the instructions so they can be redisplayed
	strInstructions = document.getElementById('InstructionsDiv').innerHTML;
	

	

	
	CompleteEmptyFeedback();

	SetUpQuestions();
	ClearTextBoxes();
	CreateStatusArray();
	

	
//Check search string for q parameter
	if (document.location.search.length > 0){
		if (ShuffleQs == false){
			var JumpTo = parseInt(document.location.search.substring(1,document.location.search.length))-1;
			if (JumpTo <= QsToShow){
				ChangeQ(JumpTo);
			}
		}
	}
}

function ShowHideQuestions(){
	FuncBtnOut(document.getElementById('ShowMethodButton'));
	document.getElementById('ShowMethodButton').style.display = 'none';
	if (ShowingAllQuestions == false){
		for (var i=0; i<QArray.length; i++){
				QArray[i].style.display = '';
			}
		document.getElementById('Questions').style.listStyleType = 'decimal';
		document.getElementById('OneByOneReadout').style.display = 'none';
		document.getElementById('ShowMethodButton').innerHTML = ShowOneByOneCaption;
		ShowingAllQuestions = true;
	}
	else{
		for (var i=0; i<QArray.length; i++){
				if (i != CurrQNum){
					QArray[i].style.display = 'none';
				}
			}
		document.getElementById('Questions').style.listStyleType = 'none';
		document.getElementById('OneByOneReadout').style.display = '';
		document.getElementById('ShowMethodButton').innerHTML = ShowAllQuestionsCaption;
		ShowingAllQuestions = false;	
	}
	document.getElementById('ShowMethodButton').style.display = 'inline';
}

function CreateStatusArray(){
	var QNum, ANum;
//For each item in the item array
	for (QNum=0; QNum<I.length; QNum++){
//Check if the question still exists (hasn't been nuked by showing a random selection)
		if (document.getElementById('Q_' + QNum) != null){
			State[QNum] = new Array();
			State[QNum][0] = -1; //Score for this q; -1 shows question not done yet
			State[QNum][1] = new Array(); //answers
			for (ANum = 0; ANum<I[QNum][3].length; ANum++){
				State[QNum][1][ANum] = 0; //answer not chosen yet; when chosen, will store its position in the series of choices
			}
			State[QNum][2] = 0; //tries at this q so far
			State[QNum][3] = 0; //incrementing percent-correct values of selected answers
			State[QNum][4] = 0; //penalties incurred for hints
			State[QNum][5] = ''; //Sequence of answers chosen by number
		}
		else{
			State[QNum] = null;
		}
	}
}



function CheckMCAnswer(QNum, ANum, Btn){
//if question doesn't exist, bail
	if (State[QNum].length < 1){return;}
	
//Get the feedback
	Feedback = I[QNum][3][ANum][1];
	
//Now show feedback and bail if question already complete
	if (State[QNum][0] > -1){
//Add an extra message explaining that the question
// is finished if defined by the user
		if (strQuestionFinished.length > 0){Feedback += '<br />' + strQuestionFinished;}
//Show the feedback
		ShowMessage(Feedback);
		return;
	}
	
//Hide the button while processing
	Btn.style.display = 'none';

//Increment the number of tries
	State[QNum][2]++;
	
//Add the percent-correct value of this answer
	State[QNum][3] += I[QNum][3][ANum][3];
	
//Store the try number in the answer part of the State array, for tracking purposes
	State[QNum][1][ANum] = State[QNum][2];
	State[QNum][5] += String.fromCharCode(65+ANum) + ',';
	
//Should this answer be accepted as correct?
	if (I[QNum][3][ANum][2] < 1){
//It's wrong

//Mark the answer
		Btn.innerHTML = IncorrectIndicator;
		
//Remove any previous score unless exercise is finished (6.0.3.8+)
		if (Finished == false){
			WriteToInstructions(strInstructions);
		}	
		
//Check whether this leaves just one MC answer unselected, in which case the Q is terminated
		var RemainingAnswer = FinalAnswer(QNum);
		if (RemainingAnswer > -1){
//Behave as if the last answer had been selected, but give no credit for it
//Increment the number of tries
			State[QNum][2]++;		
		
//Calculate the score for this question
			CalculateMCQuestionScore(QNum);

//Get the overall score and add it to the feedback
			CalculateOverallScore();
			if ((ContinuousScoring == true)||(Finished == true)){
				Feedback += '<br />' + YourScoreIs + ' ' + Score + '%.';
				WriteToInstructions(YourScoreIs + ' ' + Score + '%.');
			}
		}
	}
	else{
//It's right
//Mark the answer
		Btn.innerHTML = CorrectIndicator;
				
//Calculate the score for this question
		CalculateMCQuestionScore(QNum);

//Get the overall score and add it to the feedback
		if (ContinuousScoring == true){
			CalculateOverallScore();
			if ((ContinuousScoring == true)||(Finished == true)){
				Feedback += '<br />' + YourScoreIs + ' ' + Score + '%.';
				WriteToInstructions(YourScoreIs + ' ' + Score + '%.');
			}
		}
	}
	
//Show the button again
	Btn.style.display = 'inline';
	
//Finally, show the feedback	
	ShowMessage(Feedback);
	
//Check whether all questions are now done
	CheckFinished();
}

function CalculateMCQuestionScore(QNum){
	var Tries = State[QNum][2] + State[QNum][4]; //include tries and hint penalties
	var PercentCorrect = State[QNum][3];
	var TotAns = GetTotalMCAnswers(QNum);
	var HintPenalties = State[QNum][4];
	
//Make sure it's not already complete

	if (State[QNum][0] < 0){
//Allow for Hybrids
		if (HintPenalties >= 1){
			State[QNum][0] = 0;
		}
		else{
//This line calculates the score for this question
			if (TotAns == 1){
				State[QNum][0] = 1;
			}
			else{
				State[QNum][0] = ((TotAns-((Tries*100)/State[QNum][3]))/(TotAns-1));
			}
		}
		if (State[QNum][0] < 0){
			State[QNum][0] = 0;
		}
	}
}

function GetTotalMCAnswers(QNum){
	var Result = 0;
	for (var ANum=0; ANum<I[QNum][3].length; ANum++){
		if (I[QNum][3][ANum][4] == 1){ //This is an MC answer
			Result++;
		}
	}
	return Result;
}

function FinalAnswer(QNum){
	var UnchosenAnswers = 0;
	var FinalAnswer = -1;
	for (var ANum=0; ANum<I[QNum][3].length; ANum++){
		if (I[QNum][3][ANum][4] == 1){ //This is an MC answer
			if (State[QNum][1][ANum] < 1){ //This answer hasn't been chosen yet
				UnchosenAnswers++;
				FinalAnswer = ANum;
			}
		}
	}
	if (UnchosenAnswers == 1){
		return FinalAnswer;
	}
	else{
		return -1;
	}
}





function CalculateOverallScore(){
	var TotalWeighting = 0;
	var TotalScore = 0;
	
	for (var QNum=0; QNum<State.length; QNum++){
		if (State[QNum] != null){
			if (State[QNum][0] > -1){
				TotalWeighting += I[QNum][0];
				TotalScore += (I[QNum][0] * State[QNum][0]);
			}
		}
	}
	if (TotalWeighting > 0){
		Score = Math.floor((TotalScore/TotalWeighting)*100);
	}
	else{
//if TotalWeighting is 0, no questions so far have any value, so 
//no penalty should be shown.
		Score = 100; 
	}
}

function CheckFinished(){
	var FB = '';
	var AllDone = true;
	for (var QNum=0; QNum<State.length; QNum++){
		if (State[QNum] != null){
			if (State[QNum][0] < 0){
				AllDone = false;
			}
		}
	}
	if (AllDone == true){
	
//Report final score and submit if necessary
		CalculateOverallScore();
		FB = YourScoreIs + ' ' + Score + '%.';
		if (ShowCorrectFirstTime == true){
			var CFT = 0;
			for (QNum=0; QNum<State.length; QNum++){
				if (State[QNum] != null){
					if (State[QNum][0] >= 1){
						CFT++;
					}
				}
			}
			FB += '<br />' + CorrectFirstTime + ' ' + CFT + '/' + QsToShow;
		}
		WriteToInstructions(FB);
		
		Finished == true;

		TimeOver = true;
		Locked = true;
		


		Finished = true;
		Detail = '<?xml version="1.0"?><hpnetresult><fields>';
		for (QNum=0; QNum<State.length; QNum++){
			if (State[QNum] != null){
				if (State[QNum][5].length > 0){
					Detail += '<field><fieldname>Question #' + (QNum+1) + '</fieldname><fieldtype>question-tracking</fieldtype><fieldlabel>Q ' + (QNum+1) + '</fieldlabel><fieldlabelid>QuestionTrackingField</fieldlabelid><fielddata>' + State[QNum][5] + '</fielddata></field>';
				}
			}
		}
		Detail += '</fields></hpnetresult>';
		setTimeout('Finish()', SubmissionTimeout);
	}
}










//-->

//]]>


