

//<![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 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.ie){
		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 TopSettingWithScrollOffset(TopPercent){
	var T = Math.floor(document.getElementsByTagName('body')[0].clientHeight * (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];
	}
	
//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 (document.getElementById('Q_' + CurrQNum + '_Guess') != null){
		document.getElementById('Q_' + CurrQNum + '_Guess').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('The superiority of the American Clipper Ship','Correct.  These larger, faster vessels could bring goods to and from foreign markets faster than the competition.',1,100,1);
I[0][3][1]=new Array('The wars in Europe','Sorry.  While it is true that the warfare in Europe in the early 1800\'s was one of the reasons for the rise of the American Merchant Marine, it wasn\'t the reason that Merchant Marine traffic peaked in the 1850\'s.',0,0,1);
I[0][3][2]=new Array('Protective tariffs used to support U.S. goods over foreign goods.','Sorry.  Tariffs and other restrictive import/export laws generally have more of a negative than positive impact on Merchant Marine trade.',0,0,1);
I[0][3][3]=new Array('The 1850\'s were actually the low point for the U.S. Merchant Marine, not the high point.','Nope.  Our Merchant Marine was stronger in the 1850s than it had been before or since.',0,0,1);
I[0][3][4]=new Array('The development of the steam engine allowed the Merchant Marine to move goods faster.','Nope.  Steam propulsion would not come into general operation for merchant shipping until much later.',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 Civil War','Correct.  Southern commerce raiders, postwar concentration on westward expansion, British preeminence in building iron-hulled steamships, noncompetitive American wage scales, soaring insurance costs, and increasing shipbuilding costs all played a role in this. ',1,100,1);
I[1][3][1]=new Array('World War I','Nope.  The decline in the U.S. Merchant Marine was well-established by this time.',0,0,1);
I[1][3][2]=new Array('The War of 1812','Sorry.  While this war did have a negative effect on the U.S. Merchant Marine, it wasn\'t drastic and the Merchant Marine quickly recovered.',0,0,1);
I[1][3][3]=new Array('The Spanish-American War','Sorry.  The decline in the U.S. Merchant Marine was well-established by this time.',0,0,1);
I[1][3][4]=new Array('World War II','Nope.  The decline of the U.S. Merchant Marine occurred long before this.',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('Competitive American wage scales','Right.  The wage scale for U.S. merchant Marine sailors became non-competitive.  As American prosperity and wage scales went up, it cost too much for shippers to use U.S. crews as opposed to foreign crews.',1,100,1);
I[2][3][1]=new Array('Loss of ships due to Confederate Commerce Raiders','Sorry.  These Raiders did extensive damage to U.S. Merchant shipping, almost completely wiping the U.S. whaling industry in the waters off of Alaska, for example.',0,0,1);
I[2][3][2]=new Array('British advances in iron-hulled shipbuilding','Nope.  The British dominated this industry and the reduction of U.s. Merchant ships due to Confederate raiders only added to the British lead.',0,0,1);
I[2][3][3]=new Array('Increasing shipbuilding costs','Sorry.  Shipbuilding costs continued to rise due to a number of factors including increasing wage scales and new technologies such as steam propulsion and iron-hulls.',0,0,1);
I[2][3][4]=new Array('Soaring insurance costs','Nope.  Insurance costs did go up for a number of reasons, but primarily due to the increased cost to build the ships.',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('World War I','Right.  This was done in response to the fact that at the start of the war, only 10 percent of U.S. goods were carried in U.S. ships.',1,100,1);
I[3][3][1]=new Array('World War II','Sorry.  While a great number of ships were built during this war as well, this isn\'t the conflict that saw this number of ships constructed.',0,0,1);
I[3][3][2]=new Array('The Civil War','Sorry.  The Civil War saw the decline of the U.S. Merchant Marine fleet, due to an number of reasons including the actions of Confederate raiders.',0,0,1);
I[3][3][3]=new Array('The War of 1812','Nope.  Nowhere near this many ships were built during the war of 1812.  The U.S. economy could not afford it at that time.',0,0,1);
I[3][3][4]=new Array('The Korean War','Nope.  This conflict did not require a massive rebuilding of the U.S. Merchant Marine.',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 Merchant Marine Act','Right!  In addition, the Maritime Commission was also established under this Act to administer the rules and laws of the Act.',1,100,1);
I[4][3][1]=new Array('The Freedom on the Seas Act','Sorry.  There was no such Act signed by Congress in 1936.',0,0,1);
I[4][3][2]=new Array('The Jones Act','Sorry.  This important Congressional Act of 1920 specified that all domestic waterborne commerce between two points in the United States must be carried by U.S.-owned and operated vessels.  ',0,0,1);
I[4][3][3]=new Array('The Maritime Subsidy Act','Nope.  There was no such Act signed by Congress in 1936.',0,0,1);
I[4][3][4]=new Array('The Waterborne Commerce Act','Nope.  There was no such Act signed by Congress in 1936.',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('The Jones Act','Correct.  Its purpose was to insure for the national defense and proper growth of foreign and domestic commerce that the United States have a merchant marine of the best equipped and most suitable types of vessels, sufficient to carry the greater portion of its commerce and serve as a naval auxiliary in time of war or national emergency.  ',1,100,1);
I[5][3][1]=new Array('The Merchant Marine Act','Sorry.  This important Congressional Act of 1936 provided for the payment of construction and operating subsidies so American ship-owners would consider expansion.',0,0,1);
I[5][3][2]=new Array('The Freedom of the Seas Act','Sorry.  There was no such Congressional Act.',0,0,1);
I[5][3][3]=new Array('The Maritime Commerce Act','Nope.  There was no such Congressional Act.',0,0,1);
I[5][3][4]=new Array('The Waterborne Commerce Act','Nope.  There was no such Congressional Act.',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('By water','Right!  All other forms of transportation compliment water and sea-borne transport.',1,100,1);
I[6][3][1]=new Array('By air','Sorry.  Air transport is faster, but much more expensive.',0,0,1);
I[6][3][2]=new Array('By rail','Sorry.  While rail transport is still an important means of transport in many parts of the world, it is not the preferred method.',0,0,1);
I[6][3][3]=new Array('By long-haul trucks','Nope.  Long-haul trucks are very cost-effective, but not the most cost-effective means of moving large quantities of primary products.',0,0,1);
I[6][3][4]=new Array('By pipeline','Nope.  Pipelines do carry great quantities of oil and natural gas, but they lack the ability to carry other primary products.',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 so much of the world is dependant on imported raw materials.','Correct!  This ties the global economy together and the number and quantities of these goods is expected to increase.',1,100,1);
I[7][3][1]=new Array('Because every country in the world could get by on only its own resources if trade weren\'t established and maintained.','Nope.  No one country in the world can rely on only its own resources.  All countries must import.',0,0,1);
I[7][3][2]=new Array('Because the stock markets of the nations of the world are tied together.','Nope.  While they tend to react to each other in some degree, they are not tied to each other.',0,0,1);
I[7][3][3]=new Array('Because the various raw materials of the world are sold on the world market rather than bought by individual countries.','Sorry.  Individual countries and businesses buy and sell raw materials directly to other countries and businesses all the time.',0,0,1);
I[7][3][4]=new Array('Because there only so many resources to go around and so they must be shared.','Sorry.  While it is true that resources are limited, the world economy operates on the principal of supply and demand and not the shared needs of the world.',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('That all domestic cargoes shipped between U.S. ports be carried in U.S.-owned and operated vessels.','Right.  This helped keep the U.S. Merchant Marine fleet going, but it doesn\'t apply to cargoes destined for foreign ports.',1,100,1);
I[8][3][1]=new Array('That all international cargoes shipped from U.S. ports be carried in U.S.-owned and operated vessels.','Sorry.  The Jones Act did not restrict international cargoes.',0,0,1);
I[8][3][2]=new Array('That all domestic cargoes shipped between U.S. ports be carried in foreign-owned and operated vessels.','Nope.  The Jones Act was designed to help U.S.-owned and operated vessels, not foreign-owned and operated vessels.',0,0,1);
I[8][3][3]=new Array('That all international cargoes shipped from U.S. ports be carried in foreign-owned and operated vessels.','Nope.  The Jones Act was designed to help U.S.-owned and operated vessels, not foreign-owned and operated vessels.',0,0,1);
I[8][3][4]=new Array('The payment of construction and operating subsidies to American ship-owners so that they would consider expansion.','Sorry.  That was the done in the Merchant Marine Act of 1936.',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('50 percent','Right.  It is generally just slightly above this minimum.',1,100,1);
I[9][3][1]=new Array('100 percent','Nope.  There isn\'t enough U.S.-owned shipping to make this happen and it would be very expensive even if it were.',0,0,1);
I[9][3][2]=new Array('25 percent','Nope.  It is a larger amount than this.',0,0,1);
I[9][3][3]=new Array('90 percent','Sorry.  There isn\'t enough U.S.-owned shipping to make this happen and it would be very expensive even if it were.',0,0,1);
I[9][3][4]=new Array('75 percent','Sorry.  While the percentage of U.S. Government cargo being shipped in U.S.-owned shipping has risen to this level at times, this is not the minimum required by federal law.',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('Miami','Right.  While Miami rounds out the top ten, it is not in the top five.',1,100,1);
I[10][3][1]=new Array('New York/New Jersey','Sorry.  The New York/New Jersey port system leads the U.S. in volume of cargo traffic.',0,0,1);
I[10][3][2]=new Array('Long Beach','Sorry.  Long Beach is the second largest U.S. port in terms of volume of cargo.',0,0,1);
I[10][3][3]=new Array('Los Angles','Nope.  Los Angles is the third largest U.S. port in terms of volume of cargo.',0,0,1);
I[10][3][4]=new Array('Charleston','Nope.  Charleston is the fourth largest U.S. port in terms of volume of cargo.',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('Asia','Correct.  Japan and South Korea are the leaders in shipbuilding.',1,100,1);
I[11][3][1]=new Array('Europe','Sorry.  While some ship construction does go on here, it doesn\'t come close to the 70 percent figure.',0,0,1);
I[11][3][2]=new Array('The United States','Nope.  The U.S., for a number of reasons, builds very few ships.',0,0,1);
I[11][3][3]=new Array('Africa','Nope.  There is no significant amount of shipbuilding in Africa.',0,0,1);
I[11][3][4]=new Array('South America','Sorry.  While a number of ships are registered to South American countries, there is not a significant amount of shipbuilding there.',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('Military ship construction.','Right.  The ability to build our own warships is of utmost importance to our national security.',1,100,1);
I[12][3][1]=new Array('High-quality commercial vessels','Sorry.  While such vessels are produced at all of the major U.S. shipyards, they are not the specialty of U.S. shipyards.',0,0,1);
I[12][3][2]=new Array('Oil Tankers','Nope.  Some oil tankers are produced, but they are not the primary ship type constructed in U.S. shipyards.',0,0,1);
I[12][3][3]=new Array('Container Ships','Nope.  While some container ships are built in U.S. ports, they are the exception and not the rule.',0,0,1);
I[12][3][4]=new Array('U.S. shipyards do not specialize in one type of ship.','Sorry.  There is one type of ship which gets most of the business.',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('Because of higher U.S. labor and construction costs.','Right.  The higher standard of living in the U.S. makes it cost more to produce ships here.',1,100,1);
I[13][3][1]=new Array('Because U.S. shipbuilding facilities have fallen behind in terms of quality and technology','Nope.  U.S. shipbuilding facilities are among the most modern in the world.',0,0,1);
I[13][3][2]=new Array('Because they concentrate on Military vessel construction and do not have the time/capacity to do more.','Sorry.  While military vessel construction is the specialty of U.S. shipbuilders, there are other reasons that U.S. commercial vessel construction has fallen off.',0,0,1);
I[13][3][3]=new Array('Actually, U.S. shipbuilders lead the world in the construction of ships.','Nope.  The U.S. produces relatively few commercial ships compared to other nations.',0,0,1);
I[13][3][4]=new Array('Because the U.S. lacks many of the raw materials necessary to produce ships in great numbers.','Sorry.  While many of the materials have to be imported, this is not a factor in the reason why U.S. shipbuilding facilities do not produce large numbers of ships today.',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('Miami, Florida','Right.  While Miami is one of the top ten U.S. ports in terms of volume of cargo, it is not a significant shipbuilding port.',1,100,1);
I[14][3][1]=new Array('Bath, Maine','Nope.  The Bath Iron works is one of the premier U.S. shipbuilding facilities.',0,0,1);
I[14][3][2]=new Array('Newport News, Virginia','Sorry.  The Newport News shipyard is an important U.S. shipbuilding facility, producing many U.S. Navy warships.',0,0,1);
I[14][3][3]=new Array('Pascagoula, Mississippi','Nope.  The Ingalls shipbuilding facility in Pascagoula is a very important U.S. shipbuilding facility.',0,0,1);
I[14][3][4]=new Array('Groton, Connecticut','Sorry.  The General Dynamics/ Electric Boat Division in Groton are important shipbuilders for U.S. Navy submarines.',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('Deep-Sea mining ships','Right.  This hasn\'t been a area of exceptional expansion or innovation within U.S. shipyards.',1,100,1);
I[15][3][1]=new Array('Jumbo Tankers','Sorry.  Modern double-hulled Jumbo Tanker designs with other innovative safety features are products of U.S. shipbuilders.',0,0,1);
I[15][3][2]=new Array('Containerships','Sorry.  Innovative containership designs to improve speed, capacity and safety have been a priority at some U.S. shipbuilding facilities.',0,0,1);
I[15][3][3]=new Array('Barge Ships','Nope.  Barge ships are designed for mostly intercoastal waterway traffic and this is an important area for U.S. shipbuilding innovation.',0,0,1);
I[15][3][4]=new Array('Roll on/Roll off ships','Nope.  Roll on/Roll off ships are designed to quickly load and offload military cargo in time of conflict.  The innovations on these ships have greatly aided U.S. military operations in the past few years.',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('Containerships','Right.  The larger ones can carry some 6,000 prepackaged twenty-foot-equivalent-unit (TEU) containers, with even larger capacity 10-20,000 TEU ships now being envisioned.  ',1,100,1);
I[16][3][1]=new Array('Barge Transports','Sorry.  While barge transports are critical to intercoastal transport and trade, they are not considered the most productive type of merchant marine ship.',0,0,1);
I[16][3][2]=new Array('Roll on/Roll off Ships','Sorry.  While innovative and very important to U.S. military operations, this type of ship is not the most productive in the U.S. merchant marine fleet.',0,0,1);
I[16][3][3]=new Array('Jumbo Tankers','Nope.  While very advanced and productive, Jumbo Tankers are not the most productive type of ships in the U.S. merchant marine fleet.',0,0,1);
I[16][3][4]=new Array('Prepositioned Sealift','Nope.  Prepositioned Sealift ships of the Merchant Marine are made up of several types of ships.  They are very important to the U.S. Military in time of war, but are not the most productive type of ships.',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('Jumbo Tankers','Right.  Recent innovations in design and capacity have made these very important ships in the international energy area.',1,100,1);
I[17][3][1]=new Array('Roll on/Roll off Ships','Sorry.  These ships are designed to allow the rapid loading and offloading of military equipment in time of war.',0,0,1);
I[17][3][2]=new Array('Barge Transports','Sorry.  These type of ships are designed for general cargo transport along intercoastal waterways.',0,0,1);
I[17][3][3]=new Array('Containerships','Nope.  While some containerships may carry these types of products in limited quantities, they are not designed to be the primary method of transport.',0,0,1);
I[17][3][4]=new Array('Hazardous Materials Transports','Nope.  There are no such class of ships.',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('Tankers','Correct!  Not only do they make up the largest portion of the Merchant Marine fleet, but they also make up the largest portion of the ships that sail the world\'s oceans.',1,100,1);
I[18][3][1]=new Array('Roll on/Roll off Ships','Nope.  These type of ships, while new and very important to U.S. military operations, make up only a small percentage of Merchant Marine vessels.',0,0,1);
I[18][3][2]=new Array('Containerships','Sorry.  While there are a good number of containerships in the Merchant Marine fleet, they are not the most numerous.',0,0,1);
I[18][3][3]=new Array('Barge Transports','Sorry.  Barge Transports are important to intercoastal commerce within the U.S., but they do not make up the majority of Merchant Marine vessels.',0,0,1);
I[18][3][4]=new Array('Warships','Nope.  While Merchant Marine ships can be armed during wartime, the Merchant Marine does not have warships.',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('The Department of Commerce','Right!  The Merchant Marine falls under the Secretary of Commerce in this regard.',1,100,1);
I[19][3][1]=new Array('The Department of Defense','Sorry!  Although it might seem to make sense, the Secretary of Defense does not control the Merchant Marine, even during time of war.',0,0,1);
I[19][3][2]=new Array('The Department of State','Sorry.  The Secretary of State does not get involved in this process.',0,0,1);
I[19][3][3]=new Array('The Treasury Department','Nope.  The Secretary of the Treasury does not get involved in this process.',0,0,1);
I[19][3][4]=new Array('The Department of Homeland Security','Nope.  This wasn\'t one of the powers given to the Secretary of Homeland Security when that position was established.',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('The Military Sealift Command ','Right!  This is the "first line" in the movement of war material and supplies to our forces.  If it is not enough, then commercial sources are sought out.',1,100,1);
I[20][3][1]=new Array('The Active Merchant Fleet ','Sorry.  This group is only turned to if the primary agency cannot handle the amount of cargo and traffic.',0,0,1);
I[20][3][2]=new Array('Foreign-Flag Ships','Nope.  The use of foreign-flagged ships is the last choice for moving U.S. war materiel and supplies.',0,0,1);
I[20][3][3]=new Array('The U.S. Navy','Sorry.  While the Navy is actively involved in the process, it is not the responsibility of the Navy to arrange for the transport of this materiel.',0,0,1);
I[20][3][4]=new Array('The U.S. Coast Guard','Nope.  The Coast Guard is not the primary agency that is actively involved in this process.',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('Inactive Ships','Correct!  This group also consists of ten fast sealift ships, two aviation support ships, and a number of merchant-type ships in the Ready Reserve Fleet.',1,100,1);
I[21][3][1]=new Array('Active Ships','Sorry.  While hospital ships can be brought into active service, as they were recently for Operation Iraqi Freedom, they are not normally in this group.',0,0,1);
I[21][3][2]=new Array('National Defense Reserve Fleet Ships','Sorry.  This group consists of older merchant ships that are kept in mothballs.',0,0,1);
I[21][3][3]=new Array('Maritime Prepositioning Ships ','Nope.  These types of ships fall under the Active Ships category, and consist of merchant ships loaded with military hardware and positioned in areas of the world in which conflict involving U.S. forces is likely to occur.',0,0,1);
I[21][3][4]=new Array('Naval Combatants','Nope.  Hospital ships are never considered combatants.',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('National Defense Reserve Fleet Ships','Right!  Their usefulness is doubtful because of their limited cargo capacity, slow speed, and generally poor condition.',1,100,1);
I[22][3][1]=new Array('Active Merchant Fleet Ships','Sorry.  These ships are not controlled by the Military Sealift Command.',0,0,1);
I[22][3][2]=new Array('Maritime Prepositioning Ships ','Nope.  These ships are kept fully crewed and are available for immediate use should the need arise.',0,0,1);
I[22][3][3]=new Array('Ready Reserve Fleet Ships','Sorry.  These are newer ships, are kept in a better state of readiness and are expected to be ready to go within 96 hours.',0,0,1);
I[22][3][4]=new Array('Naval Auxiliary Ships ','Nope.  These former U.S. Navy ships are oilers, munitions ships, and stores supply ships that are civilian-crewed and regularly engage in underway replenishment operations with the fleet. ',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('RoRo ships','Correct.  "Roll on/Roll off" ships were designed and built with this ability in mind.',1,100,1);
I[23][3][1]=new Array('Containerships','Nope.  Containerships are not well suited to carry tanks and are too constrained for many other vehicles.',0,0,1);
I[23][3][2]=new Array('Barge carriers ','Sorry.  While they have shown their worth in this area, they are not the type of ship best suited to handle vehicles.',0,0,1);
I[23][3][3]=new Array('Jumbo Tankers','Nope.  This type of ship is designed to carry bulk quantities of liquids, not vehicles.',0,0,1);
I[23][3][4]=new Array('Ferries','Sorry.  While ferries are very good at carrying vehicles, they are not a type of merchant marine shipping.',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('Fewer but larger and more productive ships are being built.','Right.  These ships would carry more cargo and goods, but their loss would have a more serious impact during time of war.',1,100,1);
I[24][3][1]=new Array('Fewer but smaller and more productive ships are being built.','Sorry.  The trend in construction is for larger, not smaller ships because of the increased demand of goods around the world.',0,0,1);
I[24][3][2]=new Array('Greater numbers of ships, and more productive ships are being built.','Sorry.  Larger and more productive ships are being built, but the expense to do so is so great that they can\'t be produced in large numbers.',0,0,1);
I[24][3][3]=new Array('Greater numbers of ships which are less productive are being built.','Nope.  The trend is always toward ships which are more productive, not less.',0,0,1);
I[24][3][4]=new Array('There is no general trend in the building of merchant marine shipping.','Nope.  As the countries of the world develop and expand, there is a growing demand for increased production and efficiency in merchant shipping.',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('These are all ways that the merchant marine can contribute to the national defense.','Correct.  Another way it can contribute is through the carriage of strategic materials. ',1,100,1);
I[25][3][1]=new Array('Military sealift.','Nope.  Military sealift is the primary way that the merchant marine contributes to national defense.',0,0,1);
I[25][3][2]=new Array('Direct support of military operations.','Nope.  The merchant marine is actively involved in direct support of military operations in time of war.',0,0,1);
I[25][3][3]=new Array('Support of foreign policy.','Sorry.  While not currently a priority for the merchant marine in the United States, the "showing of the flag" by the merchant marines of other countries directly supports their foreign policy.  This is an important area for our merchant marine.',0,0,1);
I[25][3][4]=new Array('Use as auxiliary combatants.','Sorry.  In times of war, merchant marine shipping may be modified to provide limited combat support and always for self-defense.',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
		}
	}
}



function CheckMCAnswer(QNum, ANum, Btn){
//bail if question doesn't exist or exercise finished
	if ((State[QNum].length < 1)||(Finished == true)){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();
			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();
			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][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][0] >= 1){
					CFT++;
				}
			}
			FB += '<br />' + CorrectFirstTime + ' ' + CFT + '/' + State.length;
		}
		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][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);
	}
}










//-->

//]]>


