//Determine if the document has finished loading...
$(document).ready(function() {
						   
	$("#mainNavigation img").each(function() {
		//Create a variable that holds the rollover state of the current button
		rolloverSrc = $(this).attr("src");
		//Variable of the current button's rollover state 
		rollOn = rolloverSrc.replace(/.gif$/ig,"_ovr.gif");
		//Set the image's source attribute to the new graphic
		$("<img>").attr("src", rollOn);
	});
	
	$("#mainNavigation a").mouseover(function() {
		//Create a variable for source of the image
		imgsrc = $(this).children("img").attr("src");
		//Determine the image's rollover graphic
		matches = imgsrc.match(/_ovr/);
		//Display the pointer cursor
		$("a").css("cursor", "pointer");
		//No matches, rollover state
		if (!matches) {
			//Remove the file extension
			imgsrcOn = imgsrc.replace(/.gif$/ig,"_ovr.gif");
			$(this).children("img").attr("src", imgsrcOn);
		}
		
	});
	
	$("#mainNavigation a").mouseout(function() {
		//Revert back to the original button state
		$(this).children("img").attr("src", imgsrc);
		//Display the pointer cursor
		$("a").css("cursor", "pointer");
	});
	
});
