

//<![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';
//IE can't focus a hidden div; Moz needs to focus before display to avoid jumping
	if (C.gecko){
		document.getElementById('FeedbackOKButton').focus();
	}
	FDiv.style.display = 'block';

	ShowElements(false, 'input');
	ShowElements(false, 'select');
	ShowElements(false, 'object');
	if (C.ie){
		document.getElementById('FeedbackOKButton').focus();
	}
	
//
}

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.innerWidth){
		return window.innerWidth;
	}
	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{
	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){
	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 WriteToInstructions(Feedback) {
//	Feedback = '<span class="FeedbackText">' + Feedback + '</span>';
	document.getElementById('InstructionsDiv').innerHTML = Feedback;

}




function EscapeDoubleQuotes(InString){
	return InString.replace(/"/g, '&quot;')
}

function FocusAButton(){
	if (document.getElementById('CheckButton1') != null){
		document.getElementById('CheckButton1').focus();
	}
	else{
		document.getElementsByTagName('button')[0].focus();
	}
}

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;

//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;
	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){
	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('Hugo Grotius','Correct!  Known as the "Father of International Law", Grotius made these remarks in 1604.  His thoughts and comments formed the early movement that ahs become the "freedom of the seas" policy now widely accepted by all maritime nations.',1,100,1);
I[0][3][1]=new Array('President Truman','Nope.  This famous statement was made many years prior to the Truman administration.',0,0,1);
I[0][3][2]=new Array('President Roosevelt','Nope.  This famous statement was made many years prior to the Roosevelt administration.',0,0,1);
I[0][3][3]=new Array('Niccolo Machiavelli','Sorry.  Machiavelli authored the book &#x003C;em&#x003E;The Prince&#x003C;/em&#x003E;, detailing the unethical conduct and political practices of the Italian city-states at the time.',0,0,1);
I[0][3][4]=new Array('Karl Von Clausewitz','Sorry.  Clausewitz is best known for his book, <em>Vom Kreige</em> (On War), generally acclaimed as the most influential dissertation on strategy every published.',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('That was how far a cannon shell shot from a 17th century cannon could go.','Right.  It was assumed that this was as far as you could defend your coastline, so the limit was set there.  Although the initial limit was set as a result of this, as the range of cannon and gun fire increased the limit did not change.',1,100,1);
I[1][3][1]=new Array('That is the distance of the horizon at sea level.','Sorry.  The distance of the horizon at sea level is closer to 5 miles than to 3 miles.',0,0,1);
I[1][3][2]=new Array('Sailing speeds averaged 3 miles per hour and so this was the same as a one-hour warning.','Nope.  Sailing speeds were much faster than this for most of the history of sailing.',0,0,1);
I[1][3][3]=new Array('This was how far away a ship\'s cannon could fire at a land target.','Sorry.  It was not based on how far a ship could fire at a land target, but you are close.',0,0,1);
I[1][3][4]=new Array('The limit of territorial seas was never set at 3 miles.','Nope.  Up until the early 1900s the three mile territorial sea limit was fixed in international law.',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('Russia','Correct!  The Bolsheviks initially demanded a 12-mile fisheries zone but this was later expanded to a demand for a 12-mile territorial sea.',1,100,1);
I[2][3][1]=new Array('Great Britain','Sorry.  Great Britain initially opposed this extension of the limit, but joined with the majority of other maritime powers of accepting a 12 nautical mile territorial sea in 1978.',0,0,1);
I[2][3][2]=new Array('The United States','Sorry.  The United States initially opposed this extension of the limit, but joined with the majority of other maritime powers of accepting a 12 nautical mile territorial sea in 1978.',0,0,1);
I[2][3][3]=new Array('France','Nope.  Although it was involved in the later vote in 1978 that confirmed the 12 nautical mile limit, France was not the one who first proposed this limit.',0,0,1);
I[2][3][4]=new Array('Italy','Nope.  Although it was involved in the later vote in 1978 that confirmed the 12 nautical mile limit, Italy was not the one who first proposed this limit.',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('The Law of the Sea Conference','Right!  This provision was agreed to on the condition that unimpeded passage would continue through, over, and under international straits that were overlapped by the 12-mile limit.',1,100,1);
I[3][3][1]=new Array('The Maritime Nations Border Agreement','Nope.  There was no international agreement by this name.',0,0,1);
I[3][3][2]=new Array('The Conference of Littoral States','Nope.  There was no international conference by this name.',0,0,1);
I[3][3][3]=new Array('The Organization of American States Convention','Sorry.  The OAS is an active and important economic and diplomatic organization covering North and South America, but it did not set the current 12-mile limit for territorial seas.',0,0,1);
I[3][3][4]=new Array('The NATO Agreement','Sorry.  NATO, or the North Atlantic Treaty Organization, is a mutual defense and assistance pact set up by North American and Western European Countries as a response to Soviet aggression in Europe following World War II.',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('The concept of innocent passage.','Correct.  While the right of innocent passage through international straits is guaranteed under international law, it is not considered to be one of the three main precepts.',1,100,1);
I[4][3][1]=new Array('The concept of freedom of the high seas.','Sorry.  This is the first and most important of the three main precepts.  It states that no nation may restrict any areas or resources to its exclusive use or sovereignty.',0,0,1);
I[4][3][2]=new Array('The concept of the territorial sea.','Nope.  This important concept contends that coastal states have near-absolute sovereignty over a narrow band of waters adjacent to their coasts.',0,0,1);
I[4][3][3]=new Array('The concept of special contiguous zones.','Nope.  This concept identifies these zones as straits and channels where neither the rules of the high seas nor territorial seas pertain.',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('Special Contiguous Zones','Right!  These are generally straits and channels where one nation\'s 12-miole limit would overlap with another\'s.  In these cases, special rules apply to allow for the free and unrestricted transit of shipping.',1,100,1);
I[5][3][1]=new Array('Territorial Seas','Nope.  Although this is another of the main precepts of international law of the sea, territorial sea rules do not carry over into these areas.',0,0,1);
I[5][3][2]=new Array('High Seas','Nope.  Although this is one of the main precepts of international law of the sea, the rules of the high seas are not strictly followed in these areas.',0,0,1);
I[5][3][3]=new Array('Littoral Zones','Nope.  The term Littoral Zones simply refers to the sea areas adjacent to the coasts of littoral nations.',0,0,1);
I[5][3][4]=new Array('Economic Zones','Sorry.  Economic zones, giving specific fishing and mineral rights to littoral nations, do exist, but they are not areas of special limited jurisdiction.',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('Size and strength of Navies','Correct.  These conferences deal with issues of politics and peace and do not get into warfighting issues.',1,100,1);
I[6][3][1]=new Array('The breadth of territorial seas','Sorry.  Some littoral nations continue to try to expand the limit of territorial seas out past the current 12-mile limit.  The U.S. and most other maritime nations currently oppose these efforts.',0,0,1);
I[6][3][2]=new Array('Passage through straits','Nope.  The right of innocent passage through the world\'s chokepoints, such as straits and channels, continues to be an important topic at these conferences.',0,0,1);
I[6][3][3]=new Array('Fisheries','Sorry.  The extent of national fisheries and the rules governing the harvesting of fish on the open seas has been a hot topic at these conferences from the time they first started.',0,0,1);
I[6][3][4]=new Array('Mineral rights on the seabed.','Nope.  This is becoming a major issue with these conferences as technology improves our ability to harvest the resources found on the oceans\' seabeds.',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('Because larger territorial seas tend to limit mobility.','Right!  The expansion of these limits creates a greater number of choke point around the world and this tends to limit our mobility.',1,100,1);
I[7][3][1]=new Array('It would allow the Navy to get closer to an enemy coasts.','Sorry.  If a country is an "enemy", we are at war with it and will get as close as we need to anyway.',0,0,1);
I[7][3][2]=new Array('Because it would result in less of the world\'s oceans that the Navy would need to defend and control.','Sorry.  Actually, the exact opposite is true.  Smaller territorial seas would result in an increase in "high seas", and a larger area that would need to be patrolled.',0,0,1);
I[7][3][3]=new Array('It would limit the number of rules and regulations the Navy would have to know and comply with.','Nope.  There might be fewer areas that these rules would apply in if the territorial sea limits were lowered, but there would still be a need for the same number of rules and regulations.',0,0,1);
I[7][3][4]=new Array('Actually, having the narrowest possible territorial sea is not advantageous to the Navy.','Nope.  It is.  Think about how territorial seas overlap now around the world and imagine how many more of these choke points would exist if territorial sea limits were doubled.',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('Using only these routes would make the job of an enemy easier when trying to track our warships.','Correct!  Having to stick to prescribed routes and times would make our warships very predictable to potential enemies.',1,100,1);
I[8][3][1]=new Array('Because the chance of collisions at sea would go up if everyone used the same sea lanes.','Sorry. While it might be true statistically that collisions would go up if everyone was using the same sea lanes, that is not the reason why our Navy opposes this concept.',0,0,1);
I[8][3][2]=new Array('Because it would make search and rescue efforts harder when accidents as sea occurred.','Nope.  Actually, quite the opposite is true.  When all ships use specified sea lanes, it is easier for search and rescue efforts to know where to look.',0,0,1);
I[8][3][3]=new Array('Because we might not get the sea lanes we want approved and that would limit our mobility.','Sorry.  While this would be a consideration, there is a much better reason for the Navy wanting to avoid this problem.',0,0,1);
I[8][3][4]=new Array('Because having to stay within specified sea lanes would be a difficult navigation problem.','Nope.  With modern navigation tools such as GPS, it is easy today to stay within a few yards of where you need to be, even on the open sea.',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('Innocent passage','Right.  The right of innocent passage is critical given the large areas of the world where the agreed-to 12-mile territorial seas caused regions of overlapping.  Areas such as straits and channels needed to have a recognized, legal means by which shipping could transit through these areas.',1,100,1);
I[9][3][1]=new Array('Freedom of the seas','Sorry.  Freedom of the seas is a term associated with the concept of the "High Seas", where no one sovereign state may attempt to exercise legal control of waters outside of their territorial limits.',0,0,1);
I[9][3][2]=new Array('Freedom of movement','Nope.  While this certainly concerns the freedom of movement of ships at sea, this is not the term used to describe this right under international law.',0,0,1);
I[9][3][3]=new Array('Right of Legation','Sorry.  The right of legation refers to the right of a sovereign state to have representatives of it\'s government permanently located within foreign states for the purposes of negotiation.',0,0,1);
I[9][3][4]=new Array('Territorial transit','Nope.  There is not such term in international law of the sea called "Territorial transit".',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('Submarines only have this right if the transit is made on the surface.','Correct.  Transit must be made in the open and on the surface, just as any surface ship would make the transit.  This is another reason that the U.S. Navy opposes increases to territorial sea limits.  Greater limits would make more areas where territorial seas overlapped, and thus more areas where our submarines would be forced to transit on the surface under international law.',1,100,1);
I[10][3][1]=new Array('Submarines only have this right if the transit is made while submerged.','Sorry.  They specifically do not have this right if they are submerged.',0,0,1);
I[10][3][2]=new Array('Submarines must have a licensed pilot onboard when making the transit.','Sorry.  While submarines may have a licensed pilot onboard for the transit, they are not subject to a requirement to do so.',0,0,1);
I[10][3][3]=new Array('Submarines do not have the right of innocent passage.','Nope.  Submarines do have the right of innocent passage, but they has some significant rules they must follow to be allowed this right.',0,0,1);
I[10][3][4]=new Array('Submarines do not have to comply with the rules for innocent passage.','Nope.  Submarines, as do all naval vessels, have to comply with these international laws.',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('Prior notification or authorization of the countries whose waters are being transited.','Right!  While some coastal nations require this, it is not a requirement under international law.  Generally a bilateral treaty is worked out and agreed to by both parties prior to these transits.',1,100,1);
I[11][3][1]=new Array('If a submarine, transit must be on the surface and not submerged.','Sorry.  Submarines may not make innocent passage transits while submerged.  They must be on the surface, just like other maritime vessels.  Otherwise they might constitute a navigational hazard to other traffic.',0,0,1);
I[11][3][2]=new Array('The transit must not be prejudicial to the peace, good order or security of the coastal state.','Nope.  Obviously, if the transit were to cause these kinds of problems the coastal state would have the right to complain and even to take defensive actions to protect it\'s territorial waters.',0,0,1);
I[11][3][3]=new Array('The transiting ship has the right to stop and anchor if necessary for safe navigation.','Sorry.  The right to do this is guaranteed under the rights of innocent passage if such actions are necessary for safe navigation.',0,0,1);
I[11][3][4]=new Array('The transiting ship must not enter into the inland waters of the coastal state.','Nope.  The transiting vessel must remain on track and not violate the inland waters of the coastal nation.',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('To give permission to the ship to make the transit if it is following all of the rules.','Correct!  No permission is required, since the vessel making the transit is operating under international law.',1,100,1);
I[12][3][1]=new Array('It cannot hinder the innocent passage so long as the vessel follows the rules.','Sorry.  So long as the vessel follows the agreed-upon rules under international law, the coastal country cannot legally hinder its passage.',0,0,1);
I[12][3][2]=new Array('It can protect itself from acts harmful to its security.','Nope.  A sovereign state always retains the right under international law to defend itself against acts it deems harmful to its security.',0,0,1);
I[12][3][3]=new Array('It can require that customs and health inspectors board the ship before it is allowed entry into that country\'s internal waters.','Sorry.  Vessels that are going to enter into the country\'s internal waters can legally be boarded and inspected by the coastal country.',0,0,1);
I[12][3][4]=new Array('It must provide adequate publicity to know dangers to navigation in its territorial sea.','Nope.  It is a legal responsibility that the coastal country mark and provide information about all navigation hazards within its territorial seas.',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('All of these are rules that must be followed during a transit under the right of innocent passage.','Right!  Just because a coastal state has obligations and responsibilities in regard to allowing vessels to transit through its territorial seas, it doesn\'t mean it gives up its rights to the things mentioned below.  A number of other things are protected as well.  It is up to the transiting vessel to be aware of these rules and regulations.',1,100,1);
I[13][3][1]=new Array('Pollution of the waters.','Sorry.  The rules regulating pollution are much tougher inside a coastal state\'s territorial seas than they are on the open ocean.  This makes sense since any pollution within territorial seas tends to end up on the coastal state\'s beaches.  Vessels transiting these areas much know and comply with the coastal state\'s rules.',0,0,1);
I[13][3][2]=new Array('Conservation of the living resources of the sea.','Nope.  Just because a vessel has the right of innocent passage, it doesn\'t have the right to disturb or attempt to harvest the living resources of the coastal state while inside its territorial sea.  The rules and regulations of the coastal state must be followed.',0,0,1);
I[13][3][3]=new Array('The rights of hunting and fishing.','Nope.  Just because a vessel has the right of innocent passage, it doesn\'t have the right to hunt and fish inside the territorial sea.  The rules and regulations of the coastal state must be followed.',0,0,1);
I[13][3][4]=new Array('Display of the ship\'s national colors and such salutes as required by the coastal state.','Sorry.  This is a responsibility of transiting ships that must be followed.  It is an agreed upon way of ensuring that the ship knows it is transiting territorial waters and that the coastal state acknowledges this.',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('Gulfs are larger and extend deeper into the land.','Correct!  Currently there is much controversy over the question of where internal waters of bays and gulfs end and where territorial seas begin.',1,100,1);
I[14][3][1]=new Array('Bays are larger and extend deeper into the land.','Nope.  Gulfs are larger than bays.',0,0,1);
I[14][3][2]=new Array('Gulfs are larger but bays extend deeper into the land.','Sorry.  Gulfs extend deeper into the land mass than do bays.',0,0,1);
I[14][3][3]=new Array('Bays are larger but gulfs extend deeper into the land.','Sorry.  Gulfs are larger than bays.',0,0,1);
I[14][3][4]=new Array('There is no difference under international law between bays and gulfs.','Nope.  There are specific, geographical differences between the two.',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('24','Right!  If you think about it, this makes sense.  The normal limit for territorial seas is 12 miles, and twice that number is 24.  The normal 12-mile limit would extend 12 miles from each edge of the bay or gulf, making anything less than 24 miles fall within the territorial limit.',1,100,1);
I[15][3][1]=new Array('20','Sorry.  It isn\'t a nice, round number like 20.',0,0,1);
I[15][3][2]=new Array('12','Sorry.  You might be thinking about the extension of a territorial sea, which is currently set at 12 miles.',0,0,1);
I[15][3][3]=new Array('3','Nope.  This is far too small a number.  You may be thinking about the early limit set on territorial seas, which, up until approximately 100 years ago, was 3 miles.',0,0,1);
I[15][3][4]=new Array('32','Nope.  This is way too high a number.',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('The Gulf of Mexico','Correct!  No country has laid claim to the waters of the Gulf of Mexico, so there has been no disputes about it in international law.',1,100,1);
I[16][3][1]=new Array('The Gulf of Sidra','Nope.  Libya has longed claimed all of the waters within the Gulf of Sidra as territorial seas, and has even fought with the U.S. Navy in the 1980\'s over these claims.  They are not recognized as valid under international law and the U.S. Navy conducts freedom of navigation operations each year within these waters to enforce the freedom of these seas under international law.',0,0,1);
I[16][3][2]=new Array('Hudson Bay','Sorry.  Although Canada has longed claimed this enormous bay as internal waters, there is no standing or acceptance of this under international law.',0,0,1);
I[16][3][3]=new Array('The Bay of Fundy','Sorry.  The Bay of Fundy has a 65-mile entrance and was claimed as Canadian waters as early as 1852, but this has been declared an invalid claim by an international commission.',0,0,1);
I[16][3][4]=new Array('All of these bays and gulfs are examples of waters unsuccessfully claimed as territorial seas.','Nope.  There is one on the list that is not in dispute.',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 Indian Ocean','Right!  India among other countries has proposed this measure since 1971, and there is still much support regionally for it.  The underlying reason is to have the U.S. base at Diego Garcia dismantled.  The U.S., of course, opposes this.',1,100,1);
I[17][3][1]=new Array('The Arctic Ocean','Nope.  This  body of water is primarily used by military submarines of various countries, and none of the third-world countries on it\'s shores have put forward such a proposal.',0,0,1);
I[17][3][2]=new Array('The Gulf of Mexico','Sorry.  There has been no such attempt to change the international designation of the Gulf of Mexico.',0,0,1);
I[17][3][3]=new Array('The Red Sea','Sorry.  The Red Sea is a vital sea lane for warships transiting to and from the Mediterranean Sea and support for such a proposal here would get little support.',0,0,1);
I[17][3][4]=new Array('The Mediterranean Sea','Nope.  Too many countries have major Navy ports within the Mediterranean Sea for this type of proposal to ever be considered for these waters.',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('National Rivers','Correct!  They are considered a part of that country\'s internal waters.  Examples would be the Potomac, Mississippi, Thames, or Rhone rivers.',1,100,1);
I[18][3][1]=new Array('International Rivers','Sorry.  International rivers are rivers that form a boundary between two or more countries.',0,0,1);
I[18][3][2]=new Array('Thalwegs','Sorry.  A Thalweg is the name given to the center of the deepest channel between two countries, and is used to set boundary line between the two countries.',0,0,1);
I[18][3][3]=new Array('National Waters','Nope.  Although this would appear to make sense given the combination of "national" and "waters", this term is not the one applied to rivers that lie entirely within one country.',0,0,1);
I[18][3][4]=new Array('Territorial Rivers','Nope.  There is no such term under international law.',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('International Rivers','Right!  If they are not navigable, such as the Rio Grande, the territorial boundary lies in the geographic center of the river.  If navigable, the center of the deepest channel in the river is used.',1,100,1);
I[19][3][1]=new Array('National Rivers','Nope.  National Rivers lie entirely within one country and are considered a part of that country\'s internal waters.',0,0,1);
I[19][3][2]=new Array('Thalwegs','Sorry.  A Thalweg is the name given to the center of the deepest channel between two countries, and is used to set boundary line between the two countries.',0,0,1);
I[19][3][3]=new Array('Channels','Nope.  Channels can be between two or more countries, but this is not always the case.',0,0,1);
I[19][3][4]=new Array('Seaways','Sorry.  While seaways often are located between two or more countries, but this is not always the case.',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('A Thalweg','Correct.  Because the navigable channel often varies from the geographical center, the thalweg is used to determine the boundary so both nations\' ships can navigate in the river.',1,100,1);
I[20][3][1]=new Array('A Channel Marker','Sorry.  A channel marker is simply a buoy or other marking device used to mark the boundaries of a channel.',0,0,1);
I[20][3][2]=new Array('A Rhomb Line','Nope.  A rhomb line is a line that passes through all meridians at the same angle.  It is a straight line on a mercator projection, but always is a longer distance between two points than a great circle route due to the curvature of the earth.',0,0,1);
I[20][3][3]=new Array('A Contiguous Zone','Nope.  A contiguous zone is the area between 12 and 24 nautical miles seaward of the territorial sea baselines. ',0,0,1);
I[20][3][4]=new Array('A Boundary Line','Sorry.  While it does mark the boundary between two countries, this is not what it is called.',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('The Amazon','Right.  The Amazon River passes through several countries and so is considered to be an international river.',1,100,1);
I[21][3][1]=new Array('The Mississippi','Nope.  The Mississippi lies entirely within the United Sates and so is considered a national river.',0,0,1);
I[21][3][2]=new Array('The Potomac','Nope.  The Potomac lies entirely within the United Sates and so is considered a national river.',0,0,1);
I[21][3][3]=new Array('The Thames','Sorry.  The Thames lies entirely within England and so is considered a national river.',0,0,1);
I[21][3][4]=new Array('The Rhone','Sorry.  The Rhone lies entirely within France and so is considered a national river.',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 Rhone','Correct!  The Rhone River flows entirely within France and so it is considered a national river and its waters to be internal waters of France.',1,100,1);
I[22][3][1]=new Array('The Amazon','Nope.  The Amazon flows through a number of South American nations and so is considered to be an international river.',0,0,1);
I[22][3][2]=new Array('The Rhine','Sorry.  The Rhine flows through an number of Eastern European countries, and so is considered an international river.',0,0,1);
I[22][3][3]=new Array('The Congo','Nope.  The Congo flows through a number of African nations, and so is considered an international river.',0,0,1);
I[22][3][4]=new Array('The Danube','Sorry.  The Danube flows through an number of Eastern European countries, and so is considered an international river.',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('Riparian','Right!  Riparian means "pertaining to rivers, or dwelling on the bank of a river or other body of water."',1,100,1);
I[23][3][1]=new Array('Thalweg','Nope.  A Thalweg is the name given to the center of the deepest channel between two countries, and is used to set boundary line between the two countries.',0,0,1);
I[23][3][2]=new Array('International','Nope.  Although the river itself would be considered an international river, this is not the term used for the countries.',0,0,1);
I[23][3][3]=new Array('Littoral','Sorry.  Littoral nations are nations that have a coastline along a sea or ocean.  It is not a term associated with rivers.',0,0,1);
I[23][3][4]=new Array('Riverine','Sorry.  You are close.  Although riverine does refer to things in or along the banks of rivers, this is not the term used to define countries along the edge of a river under international law.',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('70','Right!  This part of the world is free for all the world to use in its commerce.',1,100,1);
I[24][3][1]=new Array('50','Sorry.  It\'s even more than this!',0,0,1);
I[24][3][2]=new Array('40','Sorry.  You need to think of a higher number.',0,0,1);
I[24][3][3]=new Array('25','Nope.  It is a much higher percentage than this!',0,0,1);
I[24][3][4]=new Array('84','Nope.  Remember, only 3/4 of the world is covered by oceans, so it would be difficult to get to 84% even if you considered lakes and rivers.',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('The Economic Zone','Right!  Living and nonliving resources within this area are under the exclusive jurisdiction of the adjacent coastal state.',1,100,1);
I[25][3][1]=new Array('The Contiguous Zone','Sorry.  A contiguous zone is the area between 12 and 24 nautical miles seaward of the territorial sea baselines. ',0,0,1);
I[25][3][2]=new Array('The Fisheries Zone','Sorry.  While fisheries within this area remain the property of the coastal state, this is not the term used to define this region under international law.',0,0,1);
I[25][3][3]=new Array('The Exploration and Development Zone','Nope.  There is no zone with such a name under international law.',0,0,1);
I[25][3][4]=new Array('The High Seas','Nope.  The high seas are all parts of the sea that are not included in the territorial sea or in the internal waters of a state.  Although the regions between 12 and 200 miles falls in to this definition, so do the waters outside of 200 miles.',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('Fisheries','Correct.  Fisheries provide a fast, low-tech and inexpensive for many small countries to come up with the food to feed their people.  Also, technology for fish harvesting has grown significantly and great areas of the ocean have been overfished and depleted as a result.  This area will continue to be a source of legal and political disputes for some time to come.',1,100,1);
I[26][3][1]=new Array('Mineral Exploration ','Nope.  Although this is a growing area of interest and dispute as the technology emerges that allows for the exploitation of the resources of the seabed, this area has not been the one that has generated the most legal attention.',0,0,1);
I[26][3][2]=new Array('Oil Production','Sorry.  Oil production and oil pollution have certainly been important issues since the end of World War II, but this area has not caused the majority of legal disputes.',0,0,1);
I[26][3][3]=new Array('Freedom of Navigation','Nope.  Freedom of Navigation is an important issue, but one on which there has been more agreement than disagreement.',0,0,1);
I[26][3][4]=new Array('Territorial Sea Limits','Sorry.  While this is an important issue that has seen change since the end of WW II, it isn\'t the area that has produced the most legal disputes.',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('200 meters','Right.  This is approximately 656 feet.  Because a depth is used and not a distance, the distance a continental shelf goes off a coastline depends on the slope of the shelf.  It can extend hundreds of miles to sea or as little as three miles.',1,100,1);
I[27][3][1]=new Array('200 feet','Sorry.  This is far too shallow a depth.  Continental Shelves go to quite a deeper depth.',0,0,1);
I[27][3][2]=new Array('656 meters','Sorry.  This is far too deep in meters, but this number would be correct if you were thinking about feet.',0,0,1);
I[27][3][3]=new Array('2000 meters','Nope.  This is far too deep, the equivalent of over 1 nautical mile!',0,0,1);
I[27][3][4]=new Array('3 nautical miles','Nope.  You are thinking perhaps about the early limit of territorial seas, which remained three miles up until about 100 years ago.',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('500 meters','Right!  This is roughly a quarter mile, which is enough of a clearance to ensure safe navigation without unduly restricting sea space.',1,100,1);
I[28][3][1]=new Array('5 miles','Sorry.  Although some distance needs to be kept from these rigs to ensure safe navigation, 5 miles is quite a bit excessive.',0,0,1);
I[28][3][2]=new Array('3 miles','Nope.  You are perhaps thinking about the old limit of a territorial sea.  Up until about 100 years ago the limit of territorial seas was 3 miles.',0,0,1);
I[28][3][3]=new Array('500 feet','Sorry.  This would be a bit too close considering the size of oil rigs and of the ships that sail the world\'s oceans.',0,0,1);
I[28][3][4]=new Array('12 miles','Nope.  You are perhaps thinking about the limit of a territorial sea, which is 12 nautical miles.',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('Manganese','Correct!  Manganese nodules are found in great quantities on the seabed of both continental shelves and in the deep seabeds of the Pacific Ocean.',1,100,1);
I[29][3][1]=new Array('Copper','Sorry.  While copper is present in several areas of the seabed, it is currently not commercially feasible to profit from harvesting it.',0,0,1);
I[29][3][2]=new Array('Zinc','Nope.  While there is trace amounts of zinc in seawater, significant deposits of zinc on or under the seabed have not been discovered.',0,0,1);
I[29][3][3]=new Array('Iron','Sorry.  While iron deposits do exist on and under the seabed in areas around the world, it is not currently commercially possible to profit from harvesting it.',0,0,1);
I[29][3][4]=new Array('Gold','Nope.  While there is trace amounts of gold in seawater, significant deposits of gold on or under the seabed have not been discovered.',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('That all activities be governed by international law in accordance with UN principals.','Right.  This is the current U.S. position on this issue.  By subjecting this area to the UN jurisdiction, the rights of all nations are best protected.',1,100,1);
I[30][3][1]=new Array('That every nation should be given equal parcels of the seabed for development.','Sorry.  The U.S. does not support the dividing up of the seabed in the same manner of the earth\'s landmasses.',0,0,1);
I[30][3][2]=new Array('That only coastal nations be given parcels of the seabed for development.','Sorry.  Even though the U.S. is a coastal nation, we recognize that any successful agreement on the deep seabeds must include all nations of the world.',0,0,1);
I[30][3][3]=new Array('That the nations with the strongest Navies be given parcels of the seabed for development.','Nope.  The size and strength of a country&#x2019;s navy does not play into the U.S. position on this issue.',0,0,1);
I[30][3][4]=new Array('That the deep seabeds be off limits to every nation permanently.','Nope.  The U.S. believes in allowing the development of the resources of the deep seabed for the good of mankind.',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('These are all areas where the U.S. is resisting attempts to impose restrictions.','Right.  Each of these areas are sources of legal disputes in the UN and the world court.  Our enemies know that limiting the movement of our Navy takes away from our ability to influence events around the world.',1,100,1);
I[31][3][1]=new Array('Navigation through or overflight of an economic zone.','Sorry.  Remember that economic zones extend out to 200 nautical miles.  If we were not able to freely navigate through and used these areas a large portion of the world\'s oceans would be off-limits.',0,0,1);
I[31][3][2]=new Array('Innocent passage of warships through territorial waters, or having to provide advance notice for this.','Nope.  Our ability to have our warships use the high seas and to transit through straits and chokepoints without having to give away their intentions through prior notice is extremely important to national security.',0,0,1);
I[31][3][3]=new Array('Submerged transit or overflight of straits.','Nope.  This is an important area since our national defense is tied to our ability to move submarines and aircraft around the world quickly.',0,0,1);
I[31][3][4]=new Array('Entrance of naval vessels into semi-enclosed areas.','Sorry.  An example of this is our freedom of navigation exercises into the Gulf of Sidra to challenge Libya\'s claim that this Gulf is their exclusive territorial sea.',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';
	}
	

	

	
	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;
		
//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
			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]);
			}
		}
	}
	Score = Math.floor((TotalScore/TotalWeighting)*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);
	}
}










//-->

//]]>


