function setupMenuForIE() {    
	var list = null;
	var mainMenu = document.getElementById("HomeMenu"); 
	for (var i=0; i < mainMenu.childNodes.length; i++) { 
		if (mainMenu.childNodes[i].nodeName == "UL") {
			list = mainMenu.childNodes[i];
			break;
		}
	}
	for (var i=0; i<list.childNodes.length; i++) { 
		var node = list.childNodes[i]; 
		if (node != null && node.nodeName=="LI") { 
			node.onmouseover = function() { this.className += "homeOver"; } 
			node.onmouseout = function() { this.className = this.className = ''; } 
		} 
	} 
};

if (window.attachEvent) {
	window.attachEvent("onload",setupMenuForIE);
}

function setupList(listID) {
	var listCell = document.getElementById(listID);
	var targetImage = null;
	var list = null;
	
	// get the image and the list from within the cell
	for (var i=0; i<listCell.childNodes.length; i++) {
		var node = listCell.childNodes[i];
		//alert(node);
		if (!node.tagName) continue;
		
		if (node.tagName.toUpperCase() == "IMG")
			targetImage = node;
		if (node.tagName.toUpperCase() == "UL")
			list = node;
	}
	
	// go through list and attach events to list items
	var firstImage = null;
	var foundFirstLink = false;
	for (var i=0; i<list.childNodes.length; i++) {
		
		var listItem = list.childNodes[i];

		if  (!listItem.tagName) continue;

		var innerImage = null;
		var innerLink = null;
		
		for (var j=0; j<listItem.childNodes.length; j++) {
			var inner = listItem.childNodes[j];
			if (!inner.tagName) continue;

			if (inner.tagName.toUpperCase() == "IMG") 
				innerImage = inner;

			if (inner.tagName.toUpperCase() == "A") {
				innerLink = inner;
			    
			    if (!foundFirstLink) {
			        innerLink.parentNode.className='selectedItem';	
			        foundFirstLink = true;
			    }
			}
		}

		
		// attach objects to the link so it knows what to do
		listItem.highlightImage = innerImage;
		listItem.firstImage = firstImage;
		
		if (firstImage == null) {
			firstImage = innerImage;
			listItem.onmouseover = function() {
				targetImage.src = this.highlightImage.src;
				this.className = 'selectedItem';
			}
		} else {
			// select this item
			listItem.onmouseover = function() {
				targetImage.src = this.highlightImage.src;
				targetImage.alt= this.highlightImage.alt;
				this.className = 'selectedItem';
				//alert(this.firstImage.parentNode);
				this.firstImage.parentNode.className = '';
				//Effect.SwitchOff(this);
			}
			// reset to the first item being selected
			listItem.onmouseout = function() {
				targetImage.src = this.firstImage.src;
				targetImage.alt = this.firstImage.alt;
				this.className = '';
				this.firstImage.parentNode.className = 'selectedItem';
			}			
		}
	}
};
window.onload = function() {		
	setupList('list1');
	setupList('list2');
	setupList('list3');
	setupList('list4');
	setupList('list5');	
};