
// Credits for photos: 
// SOL: SOHO NASA
// M30 NASA, JPL-Caltech, J. Rho (SSC/Caltech)


var BrowserAgentHeader = navigator.userAgent;

// ***** Array Utilities
function makeArray (Y)
	{
	var count;
	this.length = Y+1;
	for (var count = 1; count <= Y+1; count++)
		this[count] = 0;
	} // makeArray

function makeArray2 (X,Y)
	{
	var count;
	this.length = X+1;
	for (var count = 1; count <= X+1; count++)
		this[count] = new makeArray(Y);
	} // makeArray2

function makeArray3 (X,Y,Z)
	{
	var count;
	this.length = X+1;
	for (var count = 1; count <= X+1; count++)
		this[count] = new makeArray2(Y,Z);
	} // makeArray2

// ***** end of array utilities


// ************ Game variables
var gameNumber = 0; // each game has a number - rather arbitrary
var yourName = "Anonymous";
var gameState = "go";
var tasksDone = 0;
var numTasks = 0;
var theDeltaFactor = 1; // adjust to make all questions correct = 120 or so
var helpGiven = 0; // the specific help dialog
var correctAnswer = '';
var godMode = false;
gamePaused = false;
var numberOfSubmissions = 0;
var numberRight = 0;
var QuestionDone = new Array();
for (var i = 1; i <= 50; i++) QuestionDone[i] = false;
var fanfareSounded = false;
var totalScore = 50, percentageCorrect = 0, health = 50;
var keyThresholds = [0, 200, 400, 600, 800, 1000]; // blue,yell,or,red,gold
var maxNumKeys = 5; // for now
var haveKey = [false,false,false,false,false,false];
var keyColor = ['', 'blue','orange','red','gold', 'platinum'];
if (theLanguage == 'es') keyColor = ['', 'azul','naranja','rojo','oro', 'platino'];
var blueKeyContent = [], orangeKeyContent = [], redKeyContent = [], goldKeyContent = [], platinumKeyContent = [] // data for these loaded later from the following:
var theKeyDataFiles = ['', pathPrefix + 'GameManagement/blueKeyData.js', pathPrefix + 'GameManagement/orangeKeyData.js', pathPrefix + 'GameManagement/redKeyData.js', pathPrefix + 'GameManagement/goldKeyData.js', pathPrefix + 'GameManagment/platinumKeyData.js'];
var accumulatedScore = 0 // total score for all past games played
var globalString = ''; // useful to use as current equation, etc.
var globalArray1 = new Array(); // a global array
var globalArray2 = new Array(); // a global array
var defenceTestLoaded = false; // extra js code loaded later
var timers = new Array(); // various global timers
var misc = new Array(); // miscellaneous ones
var globalVar1 = 0;
var slideShowIntervals = 20000; // con pics ever 20 seconds
var probNoPic = 0; // set the prob to zero if you always want pics
var gameLevel = 1; // 1 = easy 5 = impossible
var pressedHelpNumTimes = 0;
var numHealths = 0;    // number of times health key pressed
var maxNumHealths = 0; // number of times health can appear
var delayTillHealth = 120000 // first appearance after a wrong answer (2 min)
var interHealth = 120000 // intervals between healths (5 min)
var healthVialsStarted = false;
var freeHintTally = 0;



var numWidgets = 1; // starts numbering at 1
var numKeys = 4; // keys widgets start at 10
var widgetOn = new Array();
var widgetOff = new Array();
var widgetOnOn = new Array();
for(var i = 1; i <= numWidgets; i++) {
	widgetOn [i] = new Image();
	widgetOn [i].src = pathPrefix + "GameManagement/pics/widget" + i.toString() + theLanguage + "On.gif";
	widgetOff [i] = new Image();
	widgetOff [i].src = pathPrefix + "GameManagement/pics/widget" + i.toString() + theLanguage +  "Off.gif";
	widgetOnOn [i] = new Image();
	widgetOnOn [i].src = pathPrefix + "GameManagement/pics/widget" + i.toString() + theLanguage +  "OnOn.gif";

// alert(widgetOff [i].src + ' ' + widgetOn [i].src);
	}
for(var i = 1; i <= numKeys; i++) {
	var j = 9+i
	widgetOn [j] = new Image();
	widgetOn [j].src = pathPrefix + "GameManagement/pics/widget" + j.toString() + "On.gif";
	widgetOff [j] = new Image();
	widgetOff [j].src = pathPrefix + "GameManagement/pics/widget" + j.toString() + "Off.gif";
	widgetOnOn [j] = new Image();
	widgetOnOn [j].src = pathPrefix + "GameManagement/pics/widget" + j.toString() + "OnOn.gif";

// alert(widgetOff [j].src + ' ' + widgetOn [i].src);
	}



var theWidget = new Array();
var theWidgetLeft = new Array();
var theWidgetTop = new Array();



// *********** cookie names
var theTotalScoreCookie = "totalGameScore";
var theKeysCookie = "keysEarned";
var gameScores = new Array() // total score for all games played on comp
for (var i = 0; i <= 100; i++) gameScores[i] = 0;


function turnOffWidget(i) {
var theCommand = "document.consoleWid" + i.toString() + ".src = widgetOff[" + i.toString() + "].src;"
var doIt = eval(theCommand);
}// turnOff
function turnOnWidget(i) {
// alert(consoleWid1.src + ' = ' + widgetOn[1].src);
var theCommand = "document.consoleWid" + i.toString() + ".src = widgetOn[" + i.toString() + "].src;"
var doIt = eval(theCommand);
}// turnOn


// *********** Game save variables
function unloadMess(){
mess = 'You have not saved the current game.\nTo save press "Cancel" and then type "Save" in the console to save the game.'
    return mess;
}

function setBunload(on){
 if (on) window.onbeforeunload = (on) ? unloadMess : null;
 else window.onbeforeunload = {}
}

gameJustSaved = true;
// function init in utilities handles setting unload stuff 


// ************ Con variables
var notBusyCon = [true,true,true,false,true,true,true,true,true,true,true];
// con[0] will be the one in the margin for tutorials


// ************ String Variables
var singlequoteMark = unescape( '%27' );
var quoteMark = unescape( '%22' );
var tab = unescape( "%09" );	// these are now the appropriate strings;
var cr = unescape( "%0D" );	
var lf = unescape( "%0A" );
var comma = ",";



// ************* Screen Colors 
var theColor = new Array();
theColor[1] = '804DCF'; // med purple
theColor[2] = 'A01F00'; // dark red
theColor[3] = '0FCB0A'; // green
theColor[4] = '682579'; // violet
theColor[5] = 'CCCCFF'; // blueish
theColor[6] = 'FF0000'; // red


// ************* Window Placement DIVS
var topPos = 125; // this was for pure html version
// var topPos = 100; // this was for the Keith version
var leftPos = 152;
var topLowerPos = topPos + 133;
var topMidPos = topPos + 51;
var topPosStr = topPos.toString()+"px";
var topLowerPosStr = topLowerPos.toString()+"px";
var topMidPosStr= topMidPos.toString()+"px";
var leftPosStr = leftPos.toString()+"px";
var farLeftPos = leftPos - 140;
var farLeftPosStr = farLeftPos.toString()+"px";


var leftMidPos = leftPos + 145;
var leftMidPosStr = leftMidPos.toString()+"px";
var leftRightPos = leftMidPos + 345;
var leftRightPosStr = leftRightPos.toString()+"px";
var farRightPos = leftRightPos + 145;
var farRightPosStr = farRightPos.toString()+"px";
var deskPos = leftMidPos + 166 - 350; // last number = half desktop width
var deskMidPos = deskPos + 350;
var deskPosStr = deskPos.toString()+"px";
var deskPosTop = 420;
var deskPosTopStr = deskPosTop.toString()+"px";
var consolePosTop = topPos + 15;
var consolePosTopStr = consolePosTop.toString()+"px";
var consolePosLeft = leftPos + 145;
var consolePosLeftStr = consolePosLeft.toString()+"px";


//* Appearance Variables
var infoTextBgColor = theColor[5];



// ************* Misc Variables
var quoteMark = unescape( '%22' );

var theWinString = new Array();




// ********** The Console
var consoleTextString = '<center><table><tr><td><font class = Computer>Welcome to the NewBrain5 remote interface NC#A7836TF. Please identify by entering your name. </font></td></tr></table></center>'

theWinString[3] = "<DIV id='console' style= 'z-index: 20; visibility: hidden; position: fixed; left: " + consolePosLeftStr + "; top: " + consolePosTopStr + "; height: 200px; width: 335px; display: none; '><div id = consoleMessage class = consoleResponse><center>NewBrain5 remote interface NC#A7836TF</center></div><div id = 'consoleCommandLine'><center><form name = 'consoleForm' method='post' onSubmit='processConsoleCommand()'><input type = 'text' class = 'consoleline' size = 40 value = '>' name = 'consoleInput' onkeypress='{if (event.keyCode==13) processConsoleCommand()}'><input type='text' name='d1' style = 'visibility: hidden' width = 1></form></center></div><center><div id = 'theResponse' style = '{position: relative; top: -30px;}' >" + consoleTextString + "</div></center></DIV>";

theWinString[7] = "<div class='transbox' id = 'consolebg' style= '{z-index: 19; visibility: hidden; position: fixed; left: " + consolePosLeftStr + "; top: " + consolePosTopStr + "; height: 200px; width: 335px; display: none; }'></div>";

// ******** input box for health points
var theHealthInputBoxStr = "<input type = 'text' size = 10 value = '' name = 'healthInput'><input type='text' name='d1' style = 'visibility: hidden; width: 1' width = 1> ";
theHealthInputBoxStr += buttonString(checkWord, 'parent.middle.dealWithHealthAnswer()');

// fix for safari?  
// connect('myForm', 'onsubmit', function(e) { e.stop(); });

// older one here:
//var theHealthInputBoxStr = "<input type = 'text' size = 10 value = '' name = 'healthInput' onkeypress='{if (event.keyCode==13) parent.middle.dealWithHealthAnswer()}'><input type='text' name='d1' style = 'visibility: hidden; width: 1' width = 1>"

// ******** hidden element to absorb "enters"
var theCushion = "<input type='text' name='d1' style = 'visibility: hidden; width: 1' width = 1>";

// ******** status Meters in Con9
var theMetersDefs = "<span id='numericalMeter' style = '{width: 135px height: 42px}'>&nbsp;</span><span id='geometricMeter' style = '{width: 135px height: 42px}'>&nbsp;</span><span id='algebraicMeter' style = '{width: 135px height: 41px}'>&nbsp;</span>";

var theScoreMeter = "<center><DIV id = 'meters' style= '{z-index: 20; visibility: hidden; height: 135px; width: 135px; border: thin black solid; background-color : #804DCF; }'>" + theMetersDefs  + "</DIV></center>";


// ******** Message Div
var theMessageDiv = "<center><DIV id = 'message' class = 'messageStyle'> </DIV></center>";


// *** Information window overlays the desktop right now
var infoDepth = 0; // current depth of following links in information windows
// will be set to zero whenever a new generation of infoscreens opens 
// (eg in a task)
// or when clicking on a picture
var currentInfo = new Array(); 
// The above will contain the variable name of the currently displayed information string for "back button" purposes.
// The depth is given by the level of the window,
var infoPosTop = deskPosTop;
var infoPosTopStr = infoPosTop.toString()+"px";
theWinString[13] = "<DIV id = infoText style = '{z-index: 25; visibility: hidden; position: absolute; left: " + deskPosStr + "; top: " + infoPosTopStr + "; height: 220px; width: 700px; border: thin black solid; background-color : #" + infoTextBgColor + "; overflow : auto;}'></DIV>";


// Information Window Content:
var theContent = new Array();
theContent[3] = "<br><b>Schrodinger Equation </b><br>The so-called " + quoteMark + "Schrodinger equation," + quoteMark + " a curiously primitive and amusing relic of an ancient humanoid civilization in Sector 6073b. (The species itself is believed to have been annihilated by an asteroid impact 3 billion years before the Wars.) <p class = messageStyle>See also <a href = 'javascript: parent.middle.showInfo(parent.middle.theContent[4])'>the so-called Einstein field equation</a>.<p>&nbsp;";

theContent[4] = "<br><b>Einstein Field Equation</b><br>The " + quoteMark + "Einstein field equation," + quoteMark + " one of the earliest known primitive cosmological endeavors, thought to be the work of a mad scientist of the an ancient humanoid civilization in Sector 6073b. <p class = messageStyle>See also <a href = 'javascript: parent.middle.showInfo(parent.middle.theContent[3])'> the so-called Schrodinger equation </a>.<p>&nbsp;";

theContent[5] = "<br><b>Church-Turing Principle</b><br>The so-called " + quoteMark + " Church-Turing Principle," + quoteMark + " due to two obscure poets of an ancient civilization in Sector 6073b, is the (now obvious) assertion that it is possible to perfectly simulate physical reality on a computing machine. At the time it was introduced its dissemination was regarded as heresy, punishable by execution.";

theContent[6] = "<br><b>Richard Field</b><br> The cybernetics pioneer who, according to scientific and historical record, never existed, but who was undoubtedly the most influential force in the history of the galaxy.<p><DIV id = 'consoleWidget10' style= '{z-index: 20; }'><a href = " + quoteMark + "Javascript: if (parent.middle.haveKey[1]) parent.middle.showInfo(parent.middle.blueKeyContent[6]); else parent.middle.beep(1);" + quoteMark + " onMouseover = " + quoteMark + "Javascript: document.consoleWid1.src =  parent.middle.widgetOn[10].src"  + quoteMark + "onMouseout = " + quoteMark + "Javascript: document.consoleWid1.src = parent.middle.widgetOff [10].src"  + quoteMark + "><img src = " + quoteMark + widgetOff [10].src + quoteMark + "height = 21 width = 59 name = consoleWid1 border = 0></a><span class = messageStyle><br>You need blue key level status to learn more about Richard Field.</span></DIV>";
// continuing info about RF is in [6]




// ************ Console Little Pics
// define and preload
var numPics = 15;
var consolePicsNames = ['', 'SOL.jpg', 'M20.jpg', 'NGC1068.jpg', 'MINOX.jpg', 'LUN.jpg', 'V838.jpg', 'DOD.jpg', 'EFE.jpg', 'SE.jpg', 'DM3.jpg', 'NC.jpg', 'TIN5a.gif', 'DRG.jpg', 'HAL.png', 'RF.jpg'];
var consolePics = new Array();
for(var i = 1; i <= numPics; i++) {
consolePics[i] = new Image();
consolePics[i].src = "../../GameManagement/pics/" + consolePicsNames[i];
var thePicLetters = ['','','','','','','','','','','','','','']
var letterColors = ['', '', '','','','','','','','','','','','']
}


// ************ Console Little Pics Actions
function doAction(thePicName) {
if (gameState != "dead") {
	if(thePicName == "DM3.jpg") dealWithDeath();
	else if (thePicName == "EFE.jpg") showInfo(theContent[4]);
	else if (thePicName == "SE.jpg") showInfo(theContent[3]);
	else if (thePicName == "SOL.jpg") showInfo(theContent[5]); // Church-Turing
	else if (thePicName == "RF.jpg") showInfo(theContent[6]); // Richard Field
	else if(thePicName == "MINOX.jpg") {
		maxNumHealths += 1;
		throbKey(1);
		}
	else if(thePicName == "DOD.jpg") {
		health -= 5;
		showMeters();
		beep(10);
		if (theLanguage == "en") writeBottomMessage ("That cost you 5 health points!");
		else writeBottomMessage ("&iexcl;Eso se cost&oacute; 5 puntos de salud!");
		}
	else if(thePicName == "NC.jpg") {
		health += 5;
		beep(5);
		showMeters();
		if (theLanguage == "en") writeBottomMessage ("That earned you 5 health points!");
		else writeBottomMessage ("&iexcl;Eso se gan&oacute; 5 puntos de salud!");
		} // NC
	else if(thePicName == "TIN5a.gif") {
		if (freeHintTally == 0) {
			freeHintTally = 1;
			beep(5);
			if (theLanguage == "en") writeBottomMessage ("That earned you one free help! Use it at any time.");
			else writeBottomMessage ("&iexcl;Eso se gan&oacute; una ayuda gratis! Pueda usarla a cualquier tiempo.");
			}
		else beep(1);
		} // TIN5a

	else if(thePicName == 'DRG.jpg') {
		var theLotto = pickOne(1,2,3);
		if (theLotto == 1) {
			beep(665);
			health = 5;
			if (theLanguage == "en") writeBottomMessage ("<font color = red>Danger: Your health is down to 5 points!</font>");
			else writeBottomMessage ("<font color = red>&iexcl;Peligro: Su salud se ha bajado a 5 puntos!");
			showMeters();
				}
		else if (theLotto == 2) {
			beep(8);
			health = 95;
			if (theLanguage == "en") writeBottomMessage ("<font color = blue>Nice: Your health is now at 95 points!</font>");
			else writeBottomMessage ("<font color = red>&iexcl;Muy bien: Su slaud ha subido a 95 puntos!"); 
			showMeters();
				}
			else if (theLotto == 3) {
			beep(5);
			freeHintTally = 2;
			if (theLanguage == "en") writeBottomMessage ("That earned you two free helps! Use them at any time.");
			else writeBottomMessage ("&iexcl;Eso se gan&oacute; dos ayudas gratis! Pueda usarlas a cualquier tiempo."); 
			showMeters();
				}
		} // DRG

	else if (thePicName == "HAL.png") {
		var theFileName = pathPrefix + 'GameManagement/sounds';
		activateSound("fullest_use","wav", theFileName,60,false);

		} // HAL

else beep(1);
	} // if not dead
} // doAction





// ********* Health Vials, Keys, and similar icons
// Note: The blue key graphic is called widget1, orange key = widget2
// Note the key only appears in the middle of a game more or less after
// half the questions are answered
var theKeyDiv = new Array();
var theKeyDimensions = new Array();


// the actual key divs
// blue key 
theKeyDiv[10] =  "<td width = 59><DIV id = 'key10' style= '{z-index: 21; visibility: hidden; height: 21px; width: 59px; display = '' }'><a href = " + quoteMark + "Javascript: activateKey(10) " + quoteMark + " ><img src = " + quoteMark + pathPrefix + "GameManagement/pics/widget10Off.gif" + quoteMark + "height = 21 width = 59 border = 0></a></DIV></td>";

// orange key
theKeyDiv[11] =  "<td width = 59><DIV id = 'key11' style= '{z-index: 21; visibility: hidden; height: 21px; width: 59px; display = '' }'><a href = " + quoteMark + "Javascript: activateKey(11) " + quoteMark + " ><img src = " + quoteMark + pathPrefix + "GameManagement/pics/widget11Off.gif" + quoteMark + "height = 21 width = 59 border = 0></a></DIV></td>";

// red key
theKeyDiv[12] =  "<td width = 59><DIV id = 'key12' style= '{z-index: 21; visibility: hidden; height: 21px; width: 59px; display = '' }'><a href = " + quoteMark + "Javascript: activateKey(12) " + quoteMark + " ><img src = " + quoteMark + pathPrefix + "GameManagement/pics/widget12Off.gif" + quoteMark + "height = 21 width = 59 border = 0></a></DIV></td>";

// gold key
theKeyDiv[13] =  "<td width = 59><DIV id = 'key13' style= '{z-index: 21; visibility: hidden; height: 21px; width: 59px; display = '' }'><a href = " + quoteMark + "Javascript: activateKey(13) " + quoteMark + " ><img src = " + quoteMark + pathPrefix + "GameManagement/pics/widget13Off.gif" + quoteMark + "height = 21 width = 59 border = 0></a></DIV></td>";

// health vial is key number 10
// the next div is actually a table containing all the keys and health

if (theLanguage == "en") theKeyDiv[1] =  "<center><table cellspacing = 0><tr>" + theKeyDiv[10] + "<td align = center rowspan = 2><DIV id = 'key1' style= '{z-index: 21; visibility: hidden; }'><center><a href = " + quoteMark + "Javascript: activateKey(1) " + quoteMark + " ><img src = " + quoteMark + pathPrefix + "GameManagement/pics/widget1enOn.gif" + quoteMark + "height = 56 width = 35 border = 0></a></center></DIV></td>" + theKeyDiv[11] + "</tr><tr>" + theKeyDiv[12] + theKeyDiv[13] +"</tr></table></center>";

else theKeyDiv[1] =  "<center><table cellspacing = 0><tr>" + theKeyDiv[10] + "<td align = center rowspan = 2><DIV id = 'key1' style= '{z-index: 21; visibility: hidden; }'><center><a href = " + quoteMark + "Javascript: activateKey(1) " + quoteMark + " ><img src = " + quoteMark + pathPrefix + "GameManagement/pics/widget1esOn.gif" + quoteMark + "height = 56 width = 35 border = 0></a></center></DIV></td>" + theKeyDiv[11] + "</tr><tr>" + theKeyDiv[12] + theKeyDiv[13] + "</tr></table></center>";

theKeyDimensions[1] = [56,35];
for (var i = 1; i <= numKeys; i++) theKeyDimensions[9+i] = [21,59];



// ********** Background Sounds // loaded later 

var numBgSounds = 6;
var bgSoundNames = ["","victory_fanfare","hyperjump","swarn", "allclear", "Alarm", "taskDone"];
var bgSoundTypes = ["", "mp3", "wav", "wav", "wav", "wav", "wav", "wav"];
// loadBGSounds();


var theBgSoundTags = new Array();
for (var i = 1; i <= numBgSounds; i++) {
	var theStr = '<div id = "' + bgSoundNames[i] + 'sound"></div>';
	theBgSoundTags[i] = '<EMBED SRC= "' + pathPrefix + 'GameManagement/sounds/' + bgSoundNames[i] + '.' + bgSoundTypes[i] + '" AUTOSTART=false hidden = "true" LOOP="false" volume = 25>';
// alert(theStr);
	document.writeln(theStr);
	} // i


function loadBGSounds() {
for (var i = 1; i <= numBgSounds; i++) { 
	var theTag = document.getElementById(bgSoundNames[i] + 'sound');
	theTag.innerHTML = theBgSoundTags[i];
	}
}


// ********** Event Sounds
var numEventSounds = 15;
var eventSoundNames= ["","correct1", "correct2", "correct3","wrong1", "wrong2", "wrong3", "wrong4", "wrong5","bip1", "gulp", "szap", "gasp", "fullest_use", "WarpEng04", "fanfare"];
for (var i = 1; i <= numEventSounds; i++) {
	var theStr = '<div id = "' + eventSoundNames [i] + 'sound"><EMBED SRC= "' + pathPrefix + 'GameManagement/sounds/' + eventSoundNames [i] + '.wav" AUTOSTART=false hidden = "true" LOOP="false" volume = 80></div>';
	document.writeln(theStr);
// if (i == 1) alert(theStr);
	} // i





// ******* PR Music
//var thePRSoundStr = '<div id = "PRsound"><EMBED SRC= "sounds/N64_Doom64.mid" AUTOSTART=false hidden = "true" LOOP="true" volume = 40></div>';
//document.writeln(thePRSoundStr);


// ***** Info Screen variables
var backtrackingStep = 0; // for back/forward buttons etc
var arrowKeyHit = false; // tells showInfo to allow forward arrows
// reset to false by showInfo

// *********** Close button on Info screens
function resetBgColor() {
document.getElementById('infoText').style.backgroundColor = theColor[5];
} // resetBgColor()

var closeBox = "<a href = 'javascript: parent.middle.handleMessageClose();'><img src = '" + pathPrefix  + "GameManagement/pics/close.gif' border = 0></a>";


function handleMessageClose() {
for (var i = 22; i <= 26; i++) {clearTimeout(timers[i])};
parent.left.document.getElementById("message").style.backgroundColor = parent.middle.bgColor;
writeBottomMessage();
var theFileName = pathPrefix + 'GameManagement/sounds';
try {deactivateSound("electric_sparks","mp3", theFileName,40);}
catch(error) {}
} // handleMessageClose


// *********** Back and forward buttons on Info screens
// ** These functions returns the string link to the specified info screen
function backButton() {
var theString2 = '';
if (infoDepth > 1) {
	theString2 = "&nbsp; &nbsp; <font style = '{position: relative; top: -5px;}'><a href = 'javascript: parent.middle.arrowKeyHit = true; parent.middle.backtrackingStep += 1; parent.middle.infoDepth -= 2; parent.middle.showInfo(parent.middle.currentInfo[parent.middle.infoDepth+1]); '><font color = FF0000>&larr</font></a></font>";
// note decreased by 2 because showInfo increases it by 1.
	}
return(theString2);
}

function forwardButton() {
var theString2 = '';
if (parent.middle.backtrackingStep > 0) {
	theString2 = "&nbsp; &nbsp; <font style = '{position: relative; top: -5px;}'><a href = 'javascript: parent.middle.arrowKeyHit = true; parent.middle.backtrackingStep  -=1; parent.middle.showInfo(parent.middle.currentInfo[parent.middle.infoDepth+1]); '><font color = FF0000>&rarr;</font></a></font>";
// note decreased by 2 because showInfo increases it by 1.
	}
return(theString2);
}


function loadKeyData() {

for (var i = 1; i <= maxNumKeys; i++) {
	if (haveKey[i]) include_once(theKeyDataFiles[i]);
	} // i
}
