// initialise variables and stuffvar colours = new Array("red", "yellow", "green", "red", "yellow", "green")var mdArray = new Array()for (i=0; i<4; i++) {	mdArray[i] = new Array()}function count() {	var points = 0	for (r=0; r<4; r++) {		for (c=0; c<4; c++) {			var existColour = eval("document.b" + r + c).src			var filePath = existColour.split("/")			existColour = filePath[filePath.length-1]			if (existColour == "red.gif") {				points--			} else {				if (existColour == "green.gif") {					points++				}			} // end if		} // end for	} // end for	document.pointsgain.points.value = points	var gain = 0.274 + (points*0.002) + (points*0.001)	switch (points) {	case 14:		gain = gain * 1.1	break;	case 15:		gain = gain * 1.2	break;	case 16:		gain = gain * 1.4	break;	}	document.pointsgain.gain.value = gain} // end count()function randomise() {	for (r=0; r<4; r++) {		for (c=0; c<4; c++) {			currColourNumber = Math.round(Math.random()*5)			eval("document.b" + r + c).src = colours[currColourNumber] + ".gif"		} // end for	} // end for	count()} // end randomiserandomise()function doCol(column) {	for (r=0; r<4; r++) {		var existColour = eval("document.b" + r + column).src		var filePath = existColour.split("/")		existColour = filePath[filePath.length-1]				if (existColour == "yellow.gif") {			eval("document.b" + r + column).src= "green.gif"		} else {			if (existColour == "green.gif") {				eval("document.b" + r + column).src= "red.gif"			} else {				eval("document.b" + r + column).src= "yellow.gif"			} // end GREEN OR RED		} // end YELLOW OR ELSE	} // end for	count()} // end doColfunction doRow(row) {	for (c=0; c<4; c++) {		var existColour = eval("document.b" + row + c).src		var filePath = existColour.split("/")		existColour = filePath[filePath.length-1]				if (existColour == "yellow.gif") {			eval("document.b" + row + c).src= "green.gif"		} else {			if (existColour == "green.gif") {				eval("document.b" + row + c).src= "red.gif"			} else {				eval("document.b" + row + c).src= "yellow.gif"			} // end GREEN OR RED		} // end YELLOW OR ELSE	} // end for	count()} // end doRowfunction train(whichStat) {	count()	var gain = parseFloat(document.pointsgain.gain.value)	window.location.href="index.html?whichstat=" + whichStat + "&gain=" + gain} // end train