/*
weblogo.js

This script enables rollover functionality 
for the top-left corner logo image, without
requiring any event handlers in the html

*/

// Get the weblogo image, and assign it event handlers for onmouseover and onmouseout
function getImage()
{
	if (document.getElementById('weblogo'))
	{
		var image = document.getElementById('weblogo');
	}
	if(image) 
	{
		image.onmouseover = function(){logoRoll(image);};
		image.onmouseout = function(){logoRoll(image);};
	}
	
}

// 
function logoRoll(image)
{
	// Create a string variable giving an image source, using the global variable "logofile" (created within a previous script tag in the document header). 
	var elementSource = 'img/weblogo.png'; 
	// "image.src" returns an absolute url reference, rather than the relative path we've created; so, we use the "match" method to see if our path is contained within image.src
	if (image.src.match(elementSource)) 
	{
	image.src = '../img/weblogoRO.png'; // toggle to the rollover mage
	}
	else 
	{
		image.src = elementSource; // toggle back to the original source
	}
}

// Make the function take effect without needing event handlers in html, by using an onload event

if (window.attachEvent)
{
	window.attachEvent("onload", getImage);
}
else
{
	window.onload = function(){
	 getImage();
	}
}
