

//<![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('Intelligence Gathering','Right.  While intelligence gathering certainly goes on, it is done to support one of the three classifications of National Objectives listed here.',1,100,1);
I[0][3][1]=new Array('Political','Sorry.  The political objective of U.S. national strategy is to strive for a world of peace and stability, so that the United States and its allies can pursue their national goals without interference by any other power.',0,0,1);
I[0][3][2]=new Array('Economic','Sorry.  It is a basic objective of U.S. economic policy to promote a system of free and open trade throughout the world.',0,0,1);
I[0][3][3]=new Array('Security','Nope.  The basic U.S. national security objective is to preserve the United States as a free nation with its fundamental institutions and values intact.',0,0,1);
I[0][3][4]=new Array('These are all classifications of National Objectives.','Nope.  One of the four listed is not a classification itself, but supports the other three.  Which one is that?',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('Political','Right.  The United States and its allies cannot maintain their democratic institutions in a world of fear and anarchy, where terrorism dominates the behavior between states.',1,100,1);
I[1][3][1]=new Array('Security','Sorry.  The basic U.S. national security objective is to preserve the United States as a free nation with its fundamental institutions and values intact.',0,0,1);
I[1][3][2]=new Array('Military','Nope.  The Military is not a National Objective, but simply one of the means that the U.S. uses to promote it\'s National Objectives.',0,0,1);
I[1][3][3]=new Array('Economic','Sorry.  The economic objective of the U.S. is to promote a system of free and open trade throughout the world.',0,0,1);
I[1][3][4]=new Array('Intelligence Gathering','Nope.  Intelligence gathering is not a National Objective, but rather a tool that is used to support one of the National Objectives.',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('Security','Correct!  This means assuring the physical security of the country and maintaining an international environment in which U.S. interests are protected. ',1,100,1);
I[2][3][1]=new Array('Political','Sorry.  The political objective of U.S. national strategy is to strive for a world of peace and stability, so that the United States and its allies can pursue their national goals without interference by any other power.',0,0,1);
I[2][3][2]=new Array('Economic','Sorry.  The economic objective of the U.S. is to promote a system of free and open trade throughout the world.',0,0,1);
I[2][3][3]=new Array('Military','Nope.  The Military is not a National Objective, but simply one of the means that the U.S. uses to promote it\'s National Objectives.',0,0,1);
I[2][3][4]=new Array('Intelligence Gathering','Nope.  Intelligence gathering is not a National Objective, but rather a tool that is used to support one of the National Objectives.',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('Because our international trade and economic ties make these areas critical to our national objectives.','Right.  International peace, stability, and orderly change are also essential to U.S. security. ',1,100,1);
I[3][3][1]=new Array('The independence of these areas is not considered vital to overall U.S. national objectives.','Sorry.  This is the isolationist view which held sway in the U.S. prior to the First and Second World Wars.  In each of those cases, the lack of U.S. active participation in world diplomatic events helps precipice those conflicts.',0,0,1);
I[3][3][2]=new Array('Because we need the countries in these areas to go along with U.S. policies.','Sorry.  Many critics of U.S. foreign policy believe this, but the truth is that two independent countries never see eye-to-eye on every issue.  If this was the reason the U.S. took action overseas, we would seek to establish "puppet governments" as the communists did during the Cold War, instead of free and independent states.',0,0,1);
I[3][3][3]=new Array('Because it improves the global image of the United States and the U.S. public wants to be liked overseas.','Partial Credit.  While many times our support for the independence of nations in these areas does build up the reputation of the United States, it also causes our enemies to dislike us more.  While U.S. public opinion about how Americans are perceived overseas is important, it is hardly the driving force behind our national policy objectives.',0,50,1);
I[3][3][4]=new Array('Because we are concerned that if the nations in these areas were not independent, that they would become hostile to the U.S.','Partial Credit.  While this is certainly a consideration when nations hostile to the U.S. overthrow a government, it is not the main reason that the U.S. actively supports the independence of nations within these areas.',0,50,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 Western Hemispheric Defense phase.','Right.  During this phase the U.S. recognized that the British Navy commanded the sea and that power struggles in Europe could only draw the U.S. into wars that they couldn\'t afford.',1,100,1);
I[4][3][1]=new Array('Limited Interventionism phase','Nope.  When you have a policy of intervening in world affairs, even if it is limited in nature, you are still not practicing isolationism.',0,0,1);
I[4][3][2]=new Array('Containment of Communism phase','Sorry.  This phase marked the active involvement of the U.S. in world affairs in an attempt to limit and/or stop the advancement of communism world-wide.',0,0,1);
I[4][3][3]=new Array('The Eastern Hemispheric Defense phase','Nope.  You are thinking along the right lines.  What hemisphere is the U.S. in?',0,0,1);
I[4][3][4]=new Array('Globalization phase','Sorry.  This is not one of the three principal phases of U.S. grand strategy over the past 200 years.',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 Spanish-American War','Right!  The U.S. acquired several overseas territories as a result of this war, and it forced us out of the policy of isolationism.',1,100,1);
I[5][3][1]=new Array('The War of 1812','Sorry.  This conflict, and the defeat of Napoleon, allowed an uneasy balance of power to exist in Europe throughout much of the 19th century and allowed the U.S. to continue its policy of isolationism.',0,0,1);
I[5][3][2]=new Array('The First World War','Sorry.  While this conflict was a much stronger response from the U.S. in regards to participation in world affairs, there was an earlier conflict that marked the real point of departure from a strategy of isolation.',0,0,1);
I[5][3][3]=new Array('The Second World War','Nope.  Well before  WWII the U.S. had shown an active interest in world affairs.',0,0,1);
I[5][3][4]=new Array('The Vietnam War','Nope.  This came about much later in U.S. history.  By the time of the Vietnam conflict, the U.S. had a long history of active involvement in world affairs.',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('Flexible Response','Right!  This became U.S. strategy during the early 1960s and has continued in some form to this very day.',1,100,1);
I[6][3][1]=new Array('Massive Retaliation','Nope.  This was the strategy that preceded the one in question.  The limited, "all or nothing" approach that massive retaliation with nuclear weapons proved unworkable in practice.',0,0,1);
I[6][3][2]=new Array('Limited Interventionism','Sorry.  This was the phase of U.S. national strategy when the U.S. emerged from the Spanish-American War with overseas territories it had to protect.',0,0,1);
I[6][3][3]=new Array('Western Hemispheric Defense','Nope.  This was the very first national strategy of the U.S., and was designed for a time when the U.S. was a weak military power with almost no overseas possessions to protect.',0,0,1);
I[6][3][4]=new Array('Flexible Retaliation','Sorry.  Although this sounds reasonable given the definition of these words, there is no such U.S. strategy.',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('Strategic nuclear sufficiency, rather than an attempt to maintain nuclear superiority.','Sorry.  This is a key feature in the flexible response strategy because we can\'t always be assured of nuclear superiority everywhere, all of the time.',0,0,1);
I[7][3][1]=new Array('Larger U.S. active forces, with greater emphasis given to their readiness and modernization.','Correct.  The key term here is that flexible response focuses on SMALLER active forces, but those forces are made more mobile and ready.',1,100,1);
I[7][3][2]=new Array('Emphasis on a strong research and development program to maintain our technological superiority.','Nope.  In many ways this is the key element in our current strategy.  Our lead in technology allows us to use fewer resources more decisively.',0,0,1);
I[7][3][3]=new Array('Security assistance for the defense needs of friendly nation.','Sorry.  Our ability to quickly respond to the assistance of our allies world-wide in times of need is critical to world peace and stability.',0,0,1);
I[7][3][4]=new Array('Strong conventional capability, assisted by increased participation and improved defense capabilities of allied nations.','Nope.  These things are important if we are going to be truly ready to respond effectively on short notice.  As strong as we are, however, we must be able to rely on allies who are prepared and capable of assisting in their own defense.',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('Technological Improvement','Right.  While it is vitally important that the U.S. continue to improve and integrate technology, it isn\'t an individual element of our national military strategy.',1,100,1);
I[8][3][1]=new Array('Deterrence','Sorry.  Deterrence of aggression against the U.S. and our allies is a critical element of our national military strategy.',0,0,1);
I[8][3][2]=new Array('Flexible Response','Sorry.  This element of the strategy relates to the ability of U.S. forces to be able to respond to problems that may arise in several different ways.',0,0,1);
I[8][3][3]=new Array('Forward Strategy','Sorry.  Forward strategy -- the placing of our naval and other military units near regions of instability -- allows the U.S. to use the Atlantic and Pacific Oceans as buffers in the defense of our nation.  ',0,0,1);
I[8][3][4]=new Array('These are all principal elements of U.S. national military strategy.','Sorry.  There is one on the list that is not a principal element.',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('Ship-launched nuclear ballistic missiles.','Right.  U.S. Naval Ships do not launch nuclear ballistic missiles.  This is a job of the Navy\'s Trident Submarines.',1,100,1);
I[9][3][1]=new Array('Land-based nuclear intercontinental ballistic missiles.','Sorry.  Silos of nuclear intercontinental ballistic missiles are still maintained by the  U.S. Air Force for the defense of our nation.',0,0,1);
I[9][3][2]=new Array('Submarine-launched nuclear ballistic missiles.','Sorry.  The U.S. Navy\'s Trident Submarines are perhaps the most critical of the three nuclear delivery systems because they are constantly hidden from sight and cannot be knocked out by a "first strike".',0,0,1);
I[9][3][3]=new Array('Air-delivered nuclear bombs and missiles','Sorry.  This used to be a mission for the U.S. Navy as well as for the U.S. Air Force, but now it is just a primary mission for the U.S. Air Force.',0,0,1);
I[9][3][4]=new Array('These are all a part of the triad of strategic offensive forces.','Sorry.  "Triad" stands for "Three", and there is one on the list that is not a part of this triad.',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('Strategic Arms Limitation Treaties (SALT)','Correct!  There have been a number of SALT talks and very important treaties have occurred as a result.  these have greatly reduced the number of nuclear warheads in each of these countries.',1,100,1);
I[10][3][1]=new Array('Nuclear Non-Proliferation Treaties (NNPT)','Sorry.  These are important treaties designed to discourage third world countries to obtain nuclear weapons or nuclear technology, but these treaties do not directly deal with arms reductions between the U.S. and Russia.',0,0,1);
I[10][3][2]=new Array('Strategic Reduction of Nuclear Weapons Treaties (SRNWT)','Sorry.  It has all the right elements and sounds like it would make sense, but that\'s not it.',0,0,1);
I[10][3][3]=new Array('End The Nukes Now Talks (ETNNT)','Nope.  This sounds a bit too "unprofessional" to be the actual name given to such talks by diplomats!',0,0,1);
I[10][3][4]=new Array('Agreements on the Reduction of nuclear Missiles (ARM)','Nope.  This is not the name given to the talks or the treaties that resulted.',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('There is no other country that can match the U.S. in this area.','Correct.  The day-to-day readiness of the U.S. Navy and Marine Corps team and Air Force and Army airborne units, their force projection capabilities, and their command, control and communications capabilities make the United States unique in this regard.',1,100,1);
I[11][3][1]=new Array('Great Britain','Sorry.  While the capabilities and reach of UK forces is extensive, they haven\'t the forward-based posture and position to match those of the U.S.',0,0,1);
I[11][3][2]=new Array('China','Nope.  While China is constantly improving their armed forces and have extensive power within their region, they are primarily a regional power and not a world power.',0,0,1);
I[11][3][3]=new Array('France','Nope.  While France does project power and influence outside of Europe, particularly into regions of Africa, they haven\'t the resources and forward-presence to do this around the globe.',0,0,1);
I[11][3][4]=new Array('Germany','Sorry.  Germany has participated in a number of missions recently, but their military forces are relatively small and they can\'t perform operations anywhere in the world on short notice, as the U.S. military can.',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('Sea Control','Right!  Sea Control assumes that you have control over the entire battlespace within which naval operations are to be conducted.',1,100,1);
I[12][3][1]=new Array('Power Projection','Sorry.  This term is used to describe the various methods and means used by the Navy to protect and defend the United States and maintain our, and our Allies, freedom of movement on the seas.',0,0,1);
I[12][3][2]=new Array('Sea Dominance','Sorry.  This term assumes that you have such control at all areas and at all times.  The term we are looking for only assumes such control over a much smaller area and for a specific period of time.',0,0,1);
I[12][3][3]=new Array('Littoral Control','Nope.  Remember that the "littoral" is the immediate area offshore of a nation with a coastline.  The term we are looking for assumes control of not only the littoral area, but areas above, below and adjacent to this.',0,0,1);
I[12][3][4]=new Array('Sea Supremacy','Nope.  The term we are looking for does not assume that you will exercise control over the entire sea, but for a part of it for a specific period of time.',0,0,1);
I[13]=new Array();I[13][0]=100;
I[13][1]='';
I[13][2]='0';
I[13][3]=new Array();
I[13][3][0]=new Array('Submarine-launched ballistic missiles.','Right!  The stealthy nature of our Trident submarines means that a potential enemy would have little reaction time and no ability to stop these missiles if an enemy attacked the U.S. with nuclear weapons.',1,100,1);
I[13][3][1]=new Array('Land-launched intercontinental ballistic missiles.','Sorry.  While this is an important part of the overall U.S. effort at Strategic Deterrence, these silos are at known locations and could be targeted by a first-strike by a potential enemy.',0,0,1);
I[13][3][2]=new Array('Air-dropped nuclear bombs','Sorry.  This method may require long flights and gives the enemy more reaction time to stop the attack with anti-air defenses.',0,0,1);
I[13][3][3]=new Array('Air-launched nuclear missiles','Sorry.  This method gives the enemy more time to react and possibly target before they achieve their mission.',0,0,1);
I[13][3][4]=new Array('Surface-ship fired nuclear intercontinental ballistic missiles.','Nope.  Navy surface ships do not have the ability to launch nuclear intercontinental ballistic missiles.',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('Sea Control and Power Projection','Right!  Sea Control gives you a stable base from which you can use Power Projection to accomplish all of the missions required of the Navy.',1,100,1);
I[14][3][1]=new Array('Sea Control and Strategic Deterrence','Sorry.  Strategic Deterrence is only a part of the picture.  There is a better term which includes Strategic Deterrence and a number of other options.',0,0,1);
I[14][3][2]=new Array('Strategic Deterrence and Power Projection','Sorry.  Strategic Deterrence is a part of the Power Projection function.',0,0,1);
I[14][3][3]=new Array('Strategic Deterrence and Flexible Response','Sorry.  Deterrence and Flexible Response, along with a Forward Strategy, make up[ the three principal elements of national military strategy.',0,0,1);
I[14][3][4]=new Array('Flexible Response and Sea Control','Nope.  Sea Control assumes you have the forces and options required for Flexible Response.',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('Cruisers, Army Divisions, Attack Submarines and Air Force Fighter Wings','Right.  These are the forces the U.S. would use to respond to a conventional war.  Nuclear weapon systems like Trident Submarines and USAF ICBM missiles would fall under the Strategic Forces.',1,100,1);
I[15][3][1]=new Array('Trident Submarines, Destroyers, Cruisers and Aircraft Carriers','Sorry.  Trident Submarines carry Trident missiles, which are nuclear missiles.  These weapon systems are a part of our Strategic Forces, not our General Purpose Forces.',0,0,1);
I[15][3][2]=new Array('Destroyers, Aircraft Carriers, Air Force ICBM silos and Marine Corps Divisions','Nope.  ICBM stands for Intercontinental Ballistic Missiles.  These silos are for nuclear missiles and nuclear missiles are not a part of U.S. General Purpose Forces.',0,0,1);
I[15][3][3]=new Array('Air Force Fighter Wings, Marine Corps Divisions, Cruisers and Trident Submarines','Sorry.  Trident Submarines carry Trident missiles, which are nuclear missiles.  These weapon systems are a part of our Strategic Forces, not our General Purpose Forces.',0,0,1);
I[15][3][4]=new Array('Air Force ICBM silos, Aircraft Carriers, Army Brigades and Attack Submarines','Nope.  ICBM stands for Intercontinental Ballistic Missiles.  These silos are for nuclear missiles and nuclear missiles are not a part of U.S. General Purpose Forces.',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);
	}
}










//-->

//]]>



