function home_set_current_lifecycle(objImage)
{
	// Wipe out hover images and class names
	var imgs2 = objImage.parentNode.getElementsByTagName('img');
	for (var j = 0; j < imgs2.length; j++) {
		imgs2[j].className = '';
		imgs2[j].src = imgs2[j].src.replace('-hover.jpg', '.jpg');
		
		// Hide the associated div
		var objLifecycle = document.getElementById('lifecycle' + (j+1));
		if (objLifecycle) {
			objLifecycle.style.display = "none";
		}
	}

	// Set this as current
	objImage.className = 'current';
	
	// Change the image to the hover image
	objImage.src = objImage.src.replace('.jpg', '-hover.jpg');
	
	// Show the associated div
	var strLabel = objImage.src.substr(objImage.src.lastIndexOf('/') + 1);
	strLabel = strLabel.replace('graph', 'lifecycle');
	strLabel = strLabel.replace('-hover.jpg', '');
	var objLifecycle = document.getElementById(strLabel);
	if (objLifecycle) {
		objLifecycle.style.display = "block";
	}
}

function home_init()
{
	// Create hover and click actions for each image in #image_container
	var objContainer = document.getElementById('image_container');
	
	if (objContainer) {
		var imgs = objContainer.getElementsByTagName('img');
		
		for (var i = 0; i < imgs.length; i++) {
			imgs[i].onmouseover = function() {
				// Current doesn't respond to hover
				if (this.className != 'current') {
					// Change the image to the hover image
					this.src = this.src.replace('.jpg', '-hover.jpg');
					
					//alert(this.src.replace('.', '-hover.'));
					
					// Mark it as hovering
					this.className = 'hover';
				}
			}
			
			imgs[i].onmouseout = function() {
				// Current doesn't respond to mouseout
				if (this.className != 'current') {
					// Change the image to the regular image
					this.src = this.src.replace('-hover.jpg', '.jpg');
					
					// Mark it as normal
					this.className = '';
				}
			}
			
			imgs[i].onclick = function() {
				home_set_current_lifecycle(this);
			}
			
			if (i == 0) {
				// Default current
				home_set_current_lifecycle(imgs[i]);
			}
		}
	}
}

addLoadEvent(home_init);
