/////////////////////////////////////////////////////
//Image Swapping routines
//by: Tom McNairn April 2000
//
//this is the image swapping object
//it's pretty easy to use
//imgName is the value of the name attribute in the img tag.
//name is used to ensure the correct image in the DOM is swapped
//use name not id so it works in a cross browser environment
//wrap the image in a anchor and call the methods swapOn and swapOff in the mouse events
//e.g. var foo = new imageSwap(42,42,"foo","/images/foo_on.gif","/images/foo_off.gif");
//<a href="foo.html" onmouseover="foo.swapOn();" onmouseout="foo.swapOff();"><img name="foo" height="42" width="42" src="/images.foo_off.gif"></a>
////////////////////////////////////////////////////////
function imageSwap(width, height, imgName, onURL, offURL)
{
	if(document.images){
		this.onImage = new Image(width,height);
		this.offImage = new Image(width,height);
		this.onImage.src = onURL;
		this.offImage.src = offURL;
	}
	this.name = imgName;
	this.swapOn = swapOn;
	this.swapOff = swapOff;
}

function swapOn()
{
	if(document.images){
		document.images[this.name].src = this.onImage.src;
	}
}

function swapOff()
{
	if(document.images){
		document.images[this.name].src = this.offImage.src;
	}
}