

//<![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');

	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');
	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].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){
		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 = '';

function CompleteEmptyFeedback(){
	var QNum, ANum;
	for (QNum=0; QNum<I.length; QNum++){
		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('Reliable','Right!  Reliability of communications must never be sacrificed for security or speed.  ',1,100,1);
I[0][3][1]=new Array('Secure','Nope.  Security isn\'t always a critical factor in naval communications.  There is another listed that is important even when security isn\'t.',0,0,1);
I[0][3][2]=new Array('Rapid','Sorry.  While speed is an important aspect of communications, it isn\'t considered to be the most important.',0,0,1);
I[0][3][3]=new Array('Electronic','Nope.  While electronics, along with sound and visual methods, is a form of naval communications, it isn\'t one of the three important aspects of naval communications.',0,0,1);
I[0][3][4]=new Array('Encrypted','Sorry.  While many forms of naval communications are encrypted, this is not of the three important aspects of naval communications.',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('The Commanding Officer','Correct.  As the responsibility ultimately falls on the CO, it is his or her decision to make.',1,100,1);
I[1][3][1]=new Array('The Operations Officer','Nope.  This is never the decision of the Operations Officer.',0,0,1);
I[1][3][2]=new Array('The Communications Officer','Nope.  The Communications Officer follows a standard set of guidelines in these cases.  The guidelines are determined by another officer on this list.',0,0,1);
I[1][3][3]=new Array('The Officer of the Deck','Sorry.  While it may be necessary for the OOD to make this decision in the heat of battle or at other occasions when time doesn\'t allow consultation, he or she isn\'t the first choice.',0,0,1);
I[1][3][4]=new Array('The Command Duty Officer','Sorry.  While the CDO may have to make this decision if the proper individual isn\'t available, he or she isn\'t the first choice.',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('Naval Telecommunications','Right.  The main function of naval telecommunications is to meet the needs of the operating forces.',1,100,1);
I[2][3][1]=new Array('NavComSta','Sorry.  Naval Communications Stations are the largest of the naval telecommunications facilities on shore.',0,0,1);
I[2][3][2]=new Array('Radiotelephones','Sorry.  Radiotelephones are used for short-range tactical communications between ships.',0,0,1);
I[2][3][3]=new Array('Circuit Discipline','Nope.  This term refers to the prescribed frequencies, language, and procedures that must be used over plan language communications circuits.',0,0,1);
I[2][3][4]=new Array('Satellite Communications','Nope.  Satellite Communications only deal with communications relayed or broadcast from space-based satellites.',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('Repeating','Correct.  While messages are often repeated back to ensure that they were received correctly, this is not a primary function of naval telecommunications.',1,100,1);
I[3][3][1]=new Array('Routing','Sorry.  Once a message is received it is critical that it is rapidly routed to the proper units and personnel so that action may be taken.',0,0,1);
I[3][3][2]=new Array('Reproducing','Sorry.  The transmission of messages is just the starting point.  Once received, they must be reproduced and distributed to the units and people who need them.',0,0,1);
I[3][3][3]=new Array('Encrypting','Nope.  The encrypting of naval messages prevents our intentions from being known to a potential enemy.',0,0,1);
I[3][3][4]=new Array('Decrypting','Nope.  This is an important function if we are going to be able to understand the encrypted messages sent along by senior and subordinate units.',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('NavComSta','Right!  This stands for Naval Communications Stations.',1,100,1);
I[4][3][1]=new Array('NavAirLant','Nope.  This stands for Naval Air Forces Atlantic and is the name of the command that controls all Naval Air assets on the Atlantic coast.',0,0,1);
I[4][3][2]=new Array('TADIL','Sorry.  TADILS are Tactical Digital Information Links, which are communication links used to exchange tactical information among different naval platforms.',0,0,1);
I[4][3][3]=new Array('RATT','Sorry.  This stands for Radioteletype, a high-speed electronic message processor used by the Navy.',0,0,1);
I[4][3][4]=new Array('NavTelFac','Nope.  There is no such abbreviation because there is no such thing.',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('Radio','Correct!  Almost the entire spectrum of radio frequencies are used for naval communications.',1,100,1);
I[5][3][1]=new Array('Semaphore','Nope.  While very rapid and perhaps the best method for passing long messages visually, it is not the most important or wide-spread form of naval communications.',0,0,1);
I[5][3][2]=new Array('Nancy','Sorry.  Nancy is flashing light signaling for nighttime operations and uses infrared lights or filters that can be seen up to 7.5 miles.',0,0,1);
I[5][3][3]=new Array('Gertrude','Sorry.  Gertrude is an underwater telephone system that works through sonar.  While it has a significant use, it is hardly the most important means of naval communications.',0,0,1);
I[5][3][4]=new Array('Flaghoist','Nope.  While this is a time-tested method of passing rapid and accurate signals during daylight between ships in visual contact, it is not the most important means of communications.',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('Encryption','Right.  Today\'s electronic encryption devices and techniques make the breaking of their codes virtually impossible.',1,100,1);
I[6][3][1]=new Array('Decryption','Nope.  This is the term for the unscrambling of messages that have been electronically scrambled and sent.',0,0,1);
I[6][3][2]=new Array('Nancy','Sorry.  Nancy is flashing light signaling for nighttime operations and uses infrared lights or filters that can be seen up to 7.5 miles.',0,0,1);
I[6][3][3]=new Array('Gertrude','Sorry.  Gertrude is an underwater telephone system that works through sonar.  While it has a significant use, it is hardly the most important means of naval communications.',0,0,1);
I[6][3][4]=new Array('Facsimile','Sorry.  Facsimile is a method of transmission of pictures and graphics.  It is more commonly known as FAX.',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('Radiotelephones','Right!  Radiotelephones are used for a wide-variety of missions in the Navy and are considered to be one of the most useful military communication devices.',1,100,1);
I[7][3][1]=new Array('Radioteletype','Sorry.  Radioteletypes are high-speed message processors that can send and receive messages on ships and shore stations.  They are not used in aircraft.',0,0,1);
I[7][3][2]=new Array('Facsimile','Nope.  Facsimiles (FAXes) provide a means to send and receive photos and graphic information.',0,0,1);
I[7][3][3]=new Array('Satellite Communications Systems','Sorry.  Satellite Communications Systems provide long-range tactical and strategic communications.',0,0,1);
I[7][3][4]=new Array('Nancy','Nope.  Nancy is flashing light signaling for nighttime operations and uses infrared lights or filters that can be seen up to 7.5 miles.',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('Bravo','Right.  This is a common, well-known word that is hard to confuse when heard.',1,100,1);
I[8][3][1]=new Array('Beta','Sorry.  A "Beta" is a pre-release version of software, but it isn\'t the phonetic alphabet word for "B".',0,0,1);
I[8][3][2]=new Array('Baker','Sorry.  Interestingly, this was the word used during WW II for "B", but it isn\'t any longer.',0,0,1);
I[8][3][3]=new Array('Boat','Nope.  You\'re thinking nautical, but this isn\'t the right answer.',0,0,1);
I[8][3][4]=new Array('Barnacle','Nope.  There are very few that are three syllables long, but some are.',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('Tango','Right.  This is familiar enough but unique enough to be easily remembered.',1,100,1);
I[9][3][1]=new Array('Thomas','Sorry.  While this is a recognizable two-syllable word, it isn\'t the one used.',0,0,1);
I[9][3][2]=new Array('Turkey','Sorry.  While this is a recognizable two-syllable word, it isn\'t the one used.',0,0,1);
I[9][3][3]=new Array('Tennessee','Nope.  This would be recognizable, but it would be too long for regular use.',0,0,1);
I[9][3][4]=new Array('Ten','Nope.  If this were used it might confuse a listener as to whether a letter or number was being passed along.',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('Uniform','Correct.  What could be easier for a military person to remember?',1,100,1);
I[10][3][1]=new Array('Unicorn','Sorry.  While this is a recognizable word and would work as a phonetic alphabet word, there is a better one on the list.',0,0,1);
I[10][3][2]=new Array('Uncle','Nope.  Don\'t cry "Uncle", try again.',0,0,1);
I[10][3][3]=new Array('Uganda','Nope.  This is a small African country and not a phonetic alphabet word.',0,0,1);
I[10][3][4]=new Array('Unit','Sorry.  This would be a good phonetic word, but there is a better one on the list.',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('November','Correct.  One of the months of the year and an easily recognizable word.',1,100,1);
I[11][3][1]=new Array('Numbskull','Sorry.  This is slang, and slang is never used for the phonetic alphabet.',0,0,1);
I[11][3][2]=new Array('Northern','Nope.  While Northern is a common and easily recognizable word, it isn\'t the one used for the letter "N".',0,0,1);
I[11][3][3]=new Array('Night','Nope.  Night might work as a phonetic alphabet word, but it isn\'t the one used for "N".',0,0,1);
I[11][3][4]=new Array('Nancy','Sorry.  Nancy is flashing light signaling for nighttime operations and uses infrared lights or filters that can be seen up to 7.5 miles.',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('Low Frequency','Right!  Low frequencies tend to get trapped in the lower layers of the atmosphere and seem to "hug" the curvature of the Earth.',1,100,1);
I[12][3][1]=new Array('High Frequency','Sorry.  High frequencies can only be used for ling-of-sight communications.',0,0,1);
I[12][3][2]=new Array('Mid-range Frequencies','Sorry.  These frequencies are line-of-sight only.',0,0,1);
I[12][3][3]=new Array('They can use any frequencies.','Nope.  Some frequencies do not allow the bending of the radio waves.',0,0,1);
I[12][3][4]=new Array('Radio systems are line-of-sight only and cannot transmit over the horizon.','Nope.  At certain frequencies, radio waves tend to hug the curvature of the Earth.',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('Broadcast Radiotelegraphs','Right!  Most transmissions sent this way are sent in plain language, which would be easy for a potential enemy to intercept and understand.',1,100,1);
I[13][3][1]=new Array('Facsimile','While FAX\'s can be encrypted or non-encrypted, they are still not the least secure means of communications, even when not encrypted.  A casual listener could not tell what was being transmitted.',0,0,1);
I[13][3][2]=new Array('Gertrude','Sorry.  Gertrude is an underwater telephone system that works through sonar.  While it isn\'t a secure means of transmission, it isn\'t the least secure method listed.',0,0,1);
I[13][3][3]=new Array('Nancy','Sorry.  Nancy is flashing light signaling for nighttime operations and uses infrared lights or filters that can be seen up to 7.5 miles.  It isn\'t considered an electronic form of communications.',0,0,1);
I[13][3][4]=new Array('Semaphore','Nope.  Semaphore is a visual means of communications using signal flags, not a form of electronic communications.',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('Facsimile','Correct!  The image is scanned by a photoelectric cell that transmits electrical variations corresponding to the light and dark areas of the picture.',1,100,1);
I[14][3][1]=new Array('Nancy','Sorry.  Nancy is flashing light signaling for nighttime operations and uses infrared lights or filters that can be seen up to 7.5 miles.',0,0,1);
I[14][3][2]=new Array('Gertrude','Sorry.  Gertrude is an underwater telephone system that works through sonar.  ',0,0,1);
I[14][3][3]=new Array('Radioteletype','Nope.  These are high-speed electronic message processors that send and receive printed radio messages.',0,0,1);
I[14][3][4]=new Array('Radiotelephone','Nope.  This is the name of the standard, short-range radios that are used for most tactical communications in the Navy.',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 Naval Space Systems Command.','Right!  This is a very important task, as the modern Navy has come to rely heavily on satellite communications.',1,100,1);
I[15][3][1]=new Array('The Naval Satellite Command and Control Program.','Sorry.  There is no such command in the Navy.',0,0,1);
I[15][3][2]=new Array('The Nautical Communications Command.','Nope.  There is no such command in the Navy.',0,0,1);
I[15][3][3]=new Array('The National Aeronautical and Space Administration (NASA).','Nope.  NASA deals closely with the agency that does control these satellites, however.',0,0,1);
I[15][3][4]=new Array('The Department of Naval Research.','Sorry.  While this department does research into space-based systems, it does not control the Navy\'s satellite communications program.',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('Constellations','Correct!  There are several such constellations presently in orbit and more planned for the future.',1,100,1);
I[16][3][1]=new Array('Space Communications Groups','Nope.  There is no such thing.',0,0,1);
I[16][3][2]=new Array('Arrays','Sorry.  While satellites can have arrays of sensors (several different types of sensors) this isn\'t the term for groups of satellites.',0,0,1);
I[16][3][3]=new Array('Conglomerations','Nope.  This sounds like the type of term that might be used, but this isn\'t the correct term.',0,0,1);
I[16][3][4]=new Array('Galaxies','Sorry.  While this would seem a good descriptive choice for such groups of satellites, it wasn\'t the term chosen.',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('TADILs','Right!  Data transmitted over these links can enable geographically dispersed forces to receive a complete tactical picture for hundreds of miles.',1,100,1);
I[17][3][1]=new Array('Nancy','Sorry.  Nancy is flashing light signaling for nighttime operations and uses infrared lights or filters that can be seen up to 7.5 miles.',0,0,1);
I[17][3][2]=new Array('Gertrude','Sorry.  Gertrude is an underwater telephone system that works through sonar.  ',0,0,1);
I[17][3][3]=new Array('RATT','Nope.  RATT stands for radioteletype.  It is basically a high-speed electronic message processor.',0,0,1);
I[17][3][4]=new Array('FAX','Nope.  FAX stands for facsimile, a method of transmitting photos, graphics, charts and text electronically by wire or radio.',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('Morse','Right.  Standard international Morse code is used today, just as it has been for over a hundred years.',1,100,1);
I[18][3][1]=new Array('Nancy','Sorry.  The Nancy system uses flashing infrared lights in signaling for nighttime operations, but it isn\'t a type of code.',0,0,1);
I[18][3][2]=new Array('Gertrude','Sorry.  Gertrude is an underwater telephone system that works through sonar.  ',0,0,1);
I[18][3][3]=new Array('Facsimile','Nope.  Facsimiles (FAXes) provide a means to send and receive photos and graphic information electronically.',0,0,1);
I[18][3][4]=new Array('Semaphore','Sorry.  While semaphore is a visual signaling method, it uses hand flags instead of flashing lights.',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('It is as reliable and convenient as radio and usually more secure.','Right.  Because of these advantages, visual forms of communications remain an important part of naval communications.',1,100,1);
I[19][3][1]=new Array('It is less reliable but as convenient as radio and usually more secure.','Sorry.  It is hard to think of a radio as being more reliable than a person with a signal flag in each hand.',0,0,1);
I[19][3][2]=new Array('It is as reliable but less convenient than radio, but usually more secure.','Sorry.  While it may seem less convenient in the modern age, the truth is that this is just as convenient a method as using a radio when someone is experienced.',0,0,1);
I[19][3][3]=new Array('It is as reliable and convenient as radio but usually less secure.','Nope.  The fact that visual signals are very directional (sent in one direction), means that such signals are generally more secure.',0,0,1);
I[19][3][4]=new Array('It is less reliable but more convenient than radio, but usually less secure.','Nope.  The fact that visual signals are very directional (sent in one direction), means that such signals are generally more secure.',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('Gertrude','Right.  Gertrude is an underwater telephone system that works through sonar.',1,100,1);
I[20][3][1]=new Array('Nancy','Sorry.  The Nancy system uses flashing infrared lights in signaling for nighttime operations.',0,0,1);
I[20][3][2]=new Array('Flaghoist','Sorry. Flaghoist provides a rapid and accurate method for passing short-range messages in daylight.',0,0,1);
I[20][3][3]=new Array('Semaphore','Nope.  Semaphore remains a rapid and secure means of short-range visual communications.',0,0,1);
I[20][3][4]=new Array('Flashing Light','Nope.  Signalmen using flashing lights still pass routine messages aboard U.S. Naval ships.',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('Long-range communications','Right!  Basically, with visual signaling devices, you are limited to your line-of-sight.',1,100,1);
I[21][3][1]=new Array('Short-range communications','Nope.  This is the area where visual signals work the best.',0,0,1);
I[21][3][2]=new Array('Encrypted communications','Sorry.  Visual signals can be encoded, sent, and then decrypted on the receiving end.',0,0,1);
I[21][3][3]=new Array('Unencrypted communications','Sorry.  Visual signals can be passed in coded form or in the clear or "unencoded" form.',0,0,1);
I[21][3][4]=new Array('Secure communications','Nope.  Actually, using visual signals, signal bridge personnel can provide a much greater degree of security than open broadcast radio traffic.',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('Flaghoist','Correct!  Signals sent in this way are repeated by those receiving them, thus ensuring that the message is received accurately.',1,100,1);
I[22][3][1]=new Array('Nancy','Nope.  Nancy uses flashing infrared lights or filters to send visual signals at night.  It\'s range is limited and easily blocked.',0,0,1);
I[22][3][2]=new Array('Semaphore','Sorry.  Semaphore signals might be blocked from view of all ships in the formation.  There is a better method listed.',0,0,1);
I[22][3][3]=new Array('Flashing Light','Sorry.  Flashing lights might be blocked from view of all ships in the formation.  There is a better method listed.',0,0,1);
I[22][3][4]=new Array('Gertrude','Nope.  Gertrude is an underwater telephone system that works through sonar.',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('Top down, outboard to inboard','Right.  It makes sense to go from the top down, just like you would read a book.  It also makes sense that the farthest out would be the closest to the person getting the message, so starting there would work best.',1,100,1);
I[23][3][1]=new Array('Top down, inboard to outboard','Nope.  You are very close, however.',0,0,1);
I[23][3][2]=new Array('Bottom up, outboard to inboard','Sorry.  You never start at the bottom.',0,0,1);
I[23][3][3]=new Array('Bottom up, inboard to outboard','Sorry.  You never start at the bottom.',0,0,1);
I[23][3][4]=new Array('Left to right, from the top down','Nope.  Left and right can change as a ship changes position relative to another ship, so that method wouldn\'t work.',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('68','Right.  Used in different combinations, they can spell out thousands of signals.',1,100,1);
I[24][3][1]=new Array('26','Nope.  There are quite a bit more than that.',0,0,1);
I[24][3][2]=new Array('84','Sorry.  There aren\'t that many.',0,0,1);
I[24][3][3]=new Array('35','Nope.  There are quite a bit more than that.',0,0,1);
I[24][3][4]=new Array('52','Nope.  There is even more than that.',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('Nancy','Correct!  It is a very secure method of communications and can be used effectively up to about 7.5 miles.',1,100,1);
I[25][3][1]=new Array('Gertrude','Sorry.  Gertrude is an underwater telephone system that works through sonar.',0,0,1);
I[25][3][2]=new Array('Flaghoist','Sorry.  This is a series of flags and pennants that are hoisted aloft to pass on messages to other ships in company during daytime.',0,0,1);
I[25][3][3]=new Array('Semaphore','Nope.  This is a method of using hand flags to signal letters and numbers.',0,0,1);
I[25][3][4]=new Array('Morse','Nope.  This is a type of code using dots and dashes to transmit letters and numbers.',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('Semaphore','Right!  A good signalman can send or receive about 25 letter groups a minute.',1,100,1);
I[26][3][1]=new Array('Nancy','Sorry.  Like flashing lights, Nancy can be an effective and secure form of communications, but it is not as fast as another form listed.',0,0,1);
I[26][3][2]=new Array('Flaghoist','Nope.  Flaghoist takes more time than most of the other forms of visual communications.',0,0,1);
I[26][3][3]=new Array('Flashing Lights','Nope.  This doesn\'t have quite the speed of another form listed.',0,0,1);
I[26][3][4]=new Array('Gertrude','Sorry.  Gertrude is an underwater telephone system that works through sonar.',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('Speed and security','Right!  It is very rapid and, as it is very directional, it is very secure.',1,100,1);
I[27][3][1]=new Array('Speed and distance','Nope.  Semaphore has a significant limitation in that it is only effective out to a few hundred yards.',0,0,1);
I[27][3][2]=new Array('Reliability and distance','Sorry.  The reliability of semaphore is not a particular strength.',0,0,1);
I[27][3][3]=new Array('Reliability and security','Sorry.  The reliability of semaphore is not a particular strength.',0,0,1);
I[27][3][4]=new Array('None of these combinations are advantages of the semaphore system.','Nope.  There is a combination which matches the strengths of semaphore.',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('30','Right.  One of the strengths of this system is that there are only 30 positions that need to be learned.',1,100,1);
I[28][3][1]=new Array('50','Nope.  It isn\'t that many.',0,0,1);
I[28][3][2]=new Array('68','Sorry.  You may be thinking about the number of signal flags and pennants in the Flaghoist communications method.',0,0,1);
I[28][3][3]=new Array('26','Sorry.  You may be thinking of the number of letters in the alphabet.',0,0,1);
I[28][3][4]=new Array('12','Nope.  It is quite a bit more than that.',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('Bugles','Right.  Although navies have used bugles as a method of sound communications in the past, it is not used by our Navy today.',1,100,1);
I[29][3][1]=new Array('Whistles','Sorry.  Whistles over a ship\'s PA system is a common method of communication within the ship.',0,0,1);
I[29][3][2]=new Array('Sirens','Sorry.  Sirens are commonly used to alert the crew to dangers.',0,0,1);
I[29][3][3]=new Array('Bells','Nope.  Bells are used onboard ships to mark time.',0,0,1);
I[29][3][4]=new Array('Underwater acoustics','Nope.  There are several underwater acoustic systems, including the Gertrude system which uses sonar signals.',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('Gertrude','Right!  It is limited in range, however, and is not very secure.',1,100,1);
I[30][3][1]=new Array('Nancy','Nope.  Nancy uses flashing infrared lights or filters to send visual signals at night, above, not below, the surface of the ocean.  ',0,0,1);
I[30][3][2]=new Array('Facsimile','Nope.  Facsimiles (FAXes) provide a means to send and receive photos and graphic information electronically, but not underwater.',0,0,1);
I[30][3][3]=new Array('Sonar','Sorry.  Although the communications method in question uses sonar signals, this is not the name of the telephone system itself.',0,0,1);
I[30][3][4]=new Array('Hydrophone','Sorry.  A hydrophone is an underwater listening device that can determine a bearing on a sound contact.',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('Pyrotechnics','Correct.  They are mainly of the "fireworks" variety, such as pistol flares, colored shell bursts and Roman Candles.',1,100,1);
I[31][3][1]=new Array('Gertrude','Sorry.  Gertrude is an underwater telephone system that works through sonar.',0,0,1);
I[31][3][2]=new Array('Nancy','Nope.  Nancy uses flashing infrared lights or filters to send visual signals at night.',0,0,1);
I[31][3][3]=new Array('Radiotelephones','Sorry.  While radios are often used to broadcast emergency information, it is not the most common form of communications used for emergency signals.',0,0,1);
I[31][3][4]=new Array('Semaphore','Nope.  Semaphore is a visual communications that uses hand flags to provide rapid and secure short-range communications between two ships.',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 color of the flare','Right!  Different colored flares have different meanings.',1,100,1);
I[32][3][1]=new Array('How long the flare lasts','Sorry.  There is no way to predict this, so there is no way to use this as an indication of the meaning of the flare.',0,0,1);
I[32][3][2]=new Array('The position of the flare relative to your ship.','Nope.  The position of the flare relative to anything has no meaning here.',0,0,1);
I[32][3][3]=new Array('The position of the flare relative to the ship sending the signal','Nope.  The position of the flare relative to anything has no meaning here.',0,0,1);
I[32][3][4]=new Array('The direction the flare was fired.','Sorry.  This has no bearing on the meaning of the flare.',0,0,1);


function StartUp(){
	RemoveBottomNavBarForIE();
	

	

	
	CompleteEmptyFeedback();

	SetUpQuestions();
	ClearTextBoxes();
	CreateStatusArray();
	

	
}

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){
		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{
			State[QNum][0] = ((TotAns-(Tries-1))/TotAns)*(PercentCorrect/(100*Tries));
		}
		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);
	}
}










//-->

//]]>


