/*13Aug08 This rollover needs the use of jQuery and is explained at the following URL http://www.atlantajones.com/2007/09/27/easy-reusable-image-rollovers-with-jquery/ 

I choose JS style rollovers instead of CSS style sprites as sprites seem to few draw backs. JS main draw back is the number of HTTP requests, total size of all image files as opposed to using one and that size of the JS that needs to e there to run the rollover.

Here are the draw backs to using CSS sprites
_ Uses a background image which breaks the img/alt relationship. There are a number of work arounds. One being to place the tag that holds the background image on a layer that is above a tag of just text. This and some of the other technics seemed like hacks and are overly complicated. Compliation can make debugging a page very hard across browsers that do different things.
_ Apparently when you increase the size of the font in the browser it can reveal the sprite.
*/

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

}); */

$(document).ready(function() {
	
	////This is for the navigation
	
	// Preload all rollovers
	$("#nav_area img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		//I changed it so that it only gets images that have -nm in them. That way we are getting JS errors.
		matches = rollsrc.match(/-nm/);
		if (matches) {
			rollON = rollsrc.split('-')[0] + "_over.gif";
			$("<img>").attr("src", rollON);
		}
	});
	
	// Navigation rollovers
	$("#nav_area a").mouseover(function(){
		imgsrc = $(this).children("img").attr("src");
		matches = imgsrc.match(/_over/);
		
		// don't do the rollover if state is already ON
		if (!matches) {
			imgsrcON = imgsrc.split('-')[0] + "_over.gif";
			//alert(imgsrcON);
			$(this).children("img").attr("src", imgsrcON);
		}
		
	});
	
	$("#nav_area a").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});
	
	
	$("#thumbnails a img").mouseover(function(){
		imgsrc = $(this).attr("src");
		$(this).attr({src: "images/thumb_grey.gif", width: 93, height: 56});
		return imgsrc; //I added this because in Safari I found an error with it not being declared in the function below.
	});
	
	$("#thumbnails a img").mouseout(function(){
		$(this).attr("src", imgsrc);
	});
});