// JavaScript Document

$(document).ready(function () {
	$("#nav img, #content_footer img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = $(this).attr("data-hover")
			$("<img>").attr("src", rollON);
		});
		
		// Navigation rollovers
		$("#nav a, #content_footer a").mouseover(function(){
			if ($(this).children("img").length!=0) {
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = $(this).children("img").attr("data-hover"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			}
			
		});
		$("#nav a, #content_footer a").mouseout(function(){
			if ($(this).children("img").length!=0) {
			$(this).children("img").attr("src", imgsrc);
			}
		});	
});
