﻿		
		
		
/*============================================================
Nav img rollovers and preload.
- Wrap nav in a div with id="navWrapper"
- "on" images suffixed with "_ovr.gif" ("off" images have no suffix)
============================================================*/
$(document).ready(function() {	
	// Preload all rollovers
	$("#navWrapper a img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.gif$/ig,"_ovr.gif");
		$("<img>").attr("src", rollON);
	});
	
	// Navigation rollovers
	$("#navWrapper a").mouseover(function(){
		imgsrc = $(this).children("img").attr("src");
		matches = imgsrc.match(/_ovr/);
		
		// don't do the rollover if state is already ON
		if (!matches) {
		imgsrcON = imgsrc.replace(/.gif$/ig,"_ovr.gif"); // strip off extension
		$(this).children("img").attr("src", imgsrcON);
		}
		
	});
	$("#navWrapper a").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});		

});
