$(document).ready(function() {
		
	// Preload all rollovers
	$("#menu img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
        matches = rollsrc.match(/-on/);
        if (!matches) {  
		   rollON = rollsrc.replace(/.png$/ig,"-on.png");
		   $("<img>").attr("src", rollON);
        }
	});
	
	// Navigation rollovers
	$("#menu a").mouseover(function(){
		imgsrc = $(this).children("img").attr("src");
		matches = imgsrc.match(/-on/);	
		// don't do the rollover if state is already ON
		if (!matches) {
			imgsrcON = imgsrc.replace(/.png$/ig,"-on.png"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
		}
	});

	$("#menu a").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});				
});
