// Sets up all the potential links for each word.
// Was supposed to be MUCH simpler, but ...
function altruism() {
	myArray = new Array("08.htm","09.htm","11.htm","12.htm","13.htm");
	chooseLink();
}
function atmosphere() {
	myArray = new Array("18.htm","19.htm","21.htm","22.htm");
	chooseLink();
}
function biodiversity() {
	myArray = new Array("01.htm","02.htm","03.htm","04.htm","05.htm");
	chooseLink();
}
function consequence() {
	myArray = new Array("07.htm","10.htm","16.htm","25.htm");
	chooseLink();
}
function democracy() {
	myArray = new Array("08.htm","09.htm","10.htm","11.htm","17.htm","21.htm","25.htm","29.htm");
	chooseLink();
}
function discovery() {
	myArray  = new Array("01.htm","02.htm","23.htm","24.htm");
	chooseLink();
}
function energy() {
	myArray  = new Array("02.htm","07.htm","16.htm","20.htm","21.htm","22.htm");
	chooseLink();
}
function fear() {
	myArray  = new Array("09.htm","11.htm","13.htm","14.htm","17.htm","25.htm");
	chooseLink();
}
function genetics() {
	myArray  = new Array("01.htm","06.htm","26.htm","28.htm");
	chooseLink();
}
function global() {
	myArray  = new Array("04.htm","05.htm","10.htm","13.htm","14.htm","19.htm","23.htm");
	chooseLink();
}
function health() {
	myArray  = new Array("07.htm","12.htm","15.htm","17.htm","22.htm","26.htm");
	chooseLink();
}
function inclusion() {
	myArray  = new Array("08.htm","15.htm","17.htm","29.htm");
	chooseLink();
}
function knowledge() {
	myArray  = new Array("12.htm","15.htm","23.htm","24.htm","26.htm","27.htm","28.htm");
	chooseLink();
}
function landscape() {
	myArray  = new Array("02.htm","18.htm","20.htm","21.htm","27.htm");
	chooseLink();
}
function local() {
	myArray = new Array("03.htm","05.htm","06.htm","12.htm","18.htm","27.htm");
	chooseLink();
}
function movement() {
	myArray = new Array("16.htm","19.htm","20.htm","27.htm","29.htm");
	chooseLink();
}
function nourishment() {
	myArray = new Array("03.htm","04.htm","05.htm","06.htm","07.htm");
	chooseLink();
}
function play() {
	myArray = new Array("01.htm","13.htm","14.htm","18.htm","22.htm","24.htm","28.htm");
	chooseLink();
}
function tolerance() {
	myArray = new Array("08.htm","14.htm","23.htm","24.htm","25.htm","26.htm","28.htm");
	chooseLink();
}
function waste() {
	myArray = new Array("04.htm","09.htm","11.htm","15.htm");
	chooseLink();
}
function work() {
	myArray = new Array("03.htm","06.htm","10.htm","16.htm","19.htm","20.htm","29.htm");
	chooseLink();
}

// A rather over complicated random number generator
// (I couldn't get my simple one to work for some reason)
function rndnumber() {
	var randscript = -1;
	while (randscript < 0 || randscript > howMany || isNaN(randscript)) {
		randscript = parseInt(Math.random()*(howMany));
	}
	return randscript;
}

// Chooses the link for you, and goes to it...
function chooseLink() {
	howMany = new Number(myArray.length);
	// Chooses the link from the appropriate array...
	// alert(howMany);
	myLink = rndnumber();
	// alert(myArray[1]);
	var chosenLink = myArray[myLink];
	var fullLoc = new String(this.location);
	var currentLocation = fullLoc.substring(fullLoc.length-6, fullLoc.length-4);
	var newLocation = chosenLink.substring(chosenLink.length-6, chosenLink.length-4);
	// alert("Current: "+currentLocation+" / Next: "+newLocation);
	if (currentLocation == newLocation) {
		chooseLink();
	}else{
		this.location = chosenLink;
	}
}
