/*
 * This rollover.js script is a modified version of the Atlanta Jones script found here:
 * - http://atlantajones.com/2007/09/27/easy-reusable-image-rollovers-with-jquery/
 *
 * Special thanks goes to Atlanta Jones for his rollover script tutorial.
 * 
 */

$(document).ready(function() {
		
		// Preload all rollovers
		$(".rollover img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.jpg$/ig,"_on.jpg");
			$("<img>").attr("src", rollON);
		});
		
		// Navigation rollovers
		$(".rollover 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(/.jpg$/ig,"_on.jpg"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$(".rollover a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
	
	});