 var selectedNavItemObject = "";
  
	$(document).ready(function() {
		
		// Preload all rollovers
		$("#nav img").each(function() {
			idVal = "id_" + Math.random(1000000);
			idVal = idVal.split(".").join("");
			$(this).attr("id",idVal);
			$(this).attr("name",idVal);

			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.jpg$/ig,"-on.jpg");
			$("<img>").attr("src", rollON);
			
		});
		
		// Navigation rollovers
		$("#nav a").mouseover(function(){
			if($(this).children("img").length > 0){
			
				
				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(/.jpg$/ig,"-on.jpg"); // strip off extension
				$(this).children("img").attr("src", imgsrcON);
				}
			}
		});
	
		
	
	});
	
	$(function() {
	$('.rollover').hover(function() {
		var currentImg = $(this).attr('src');
		$(this).attr('src', $(this).attr('hover'));
		$(this).attr('hover', currentImg);
	}, function() {
		var currentImg = $(this).attr('src');
		$(this).attr('src', $(this).attr('hover'));
		$(this).attr('hover', currentImg);
	});
});
