// JavaScript Document

/* preload the images required */

if (document.images) {
	unit_1 = new Image
	unit_2 = new Image
	unit_3 = new Image
		
	unit_1.src = "images/Unit_1.png"
	unit_2.src = "images/Unit_2.png"
	unit_3.src = "images/Unit_3.png"
		
}

var currentunit = '1'

/* function to show the right unit button highlighted when mouse is over */

function highlightUnitButton(unitnumber) {	
	unitbuttontoshow = document.getElementById('unitchoiceimage')
	unitbuttontoshow.src = eval('unit_' + unitnumber + '.src')
}

/* function to put the original image back in when mouse moves off, i.e. the last unit that was actually selected */

function chgBack() {
	unitbuttontoshow.src = eval('unit_' + currentunit + '.src')
}

/* function to show the correct list of units chosen by the user and set the right unit button to stay highlighted */

function showunit(unitnumber) {
	for (i=1;i<=3;i++) {
		if (unitnumber != i) {
			var unittohide = document.getElementById('unit' + i)
			unittohide.style.display='none'
		}
	}
	var unittoshow = document.getElementById('unit' + unitnumber)
	unittoshow.style.display='block'	
	currentunit = unitnumber
}
