/*
* //////////////////////////////////////////////////////////////////
* Put init calls here, to be loaded on page load with window.onload
* //////////////////////////////////////////////////////////////////
*/
init = function() {
	initRollovers();
}

/*
* //////////////////////////////////////////////////////////////////
* This is the rollover code. To use, add class="ro" to an image tag
* This will bind event listeners to swap source of image tag to
* imagepath.jpg, imagepath_over.jpg
*
* Note: The $ES filters on image tags with the $ES('img.ro'), you
* can filter or namespace as you need to, this is a Mootools method
* //////////////////////////////////////////////////////////////////
*/
initRollovers = function() {
	var imageRollovers = $ES('img.ro');
	
	for (i = 0; i < imageRollovers.length; i++)
	{
    var myElement = imageRollovers[i];
		myElement.addEvent('mouseover', _swapOver.bindWithEvent(myElement));
		myElement.addEvent('mouseout', _swapOut.bindWithEvent(myElement));
	}
}

/*
* //////////////////////////////////////////////////////////////////
* This is the rollover code swap over function bound to mouseover.
* This just checks the image path and does an image source swap.
*
* DO NOT CALL THIS FUNCTION DIRECTLY
* //////////////////////////////////////////////////////////////////
*/
_swapOver= function() {
		imgSrc = this.src.substring(0,this.src.lastIndexOf('.'));
		imgExt = this.src.substring(this.src.lastIndexOf('.'),this.src.length);
		imgSrc += '_over' + imgExt;
		this.src = imgSrc;					
}

/*
* //////////////////////////////////////////////////////////////////
* This is the rollover code swap out function, bound to mouseout.
* This just checks the image path and does an image source swap.
*
* DO NOT CALL THIS FUNCTION DIRECTLY
* //////////////////////////////////////////////////////////////////
*/
_swapOut = function() {
		imgSrc = this.src.substring(0,this.src.lastIndexOf('_over.'));
		imgExt = this.src.substring(this.src.lastIndexOf('.'),this.src.length);
		imgSrc += imgExt;
		this.src = imgSrc;
}