/********************************************
These functions control the image swapping 
for the AIB homepage rollover image.

Styles for the rollover are contained in 
/includes/AIBPageStyle.css

********************************************/

var imageState = "primary"
var imageArray = new Array(10)
function swapper(el) {
	idEl = el.parentNode.id
	idEl = idEl.substring(9,idEl.length)
	switch (imageState) {
		case "primary":
			imageArray[idEl] = "prime"
			el.parentNode.className = "toggleOn"
			testVar = "true"
			for (var i=0; i<imageArray.length; i++){
				if (imageArray[i] != "prime") {	testVar = "false";	}
			}
			if (testVar == "true") { imageState = "secondary"; }
			break;
		case "secondary":
			imageArray[idEl] = "second"
			el.parentNode.className = "toggle"
			testVar = "true"
			for (var i=0; i<imageArray.length; i++){
				if (imageArray[i] != "second") { testVar = "false"; }
			}
			if (testVar == "true") { imageState = "primary"; }
			break;

	}
}
function arrayList() {
	for (var i=0; i<imageArray.length; i++){
		alert(imageArray[i])
	}
	alert(imageState)
}
