jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$(document).ready(function() {
	$.preloadImages("images/nav_register_over.png",
					"images/nav_exhibitor_resources_over.png",
					"images/nav_attendee_resources_over.png",
					"images/nav_map_over.png",
					"images/nav_contact_over.png");
	
	
	$("#mainNav img").each(function() {
		$(this).hover(
			function() {
				//alert("hovering: " + this.id + "_over.png");
				$(this).data("origImg",$(this).attr("src"));
				$(this).attr("src", "images/" + this.id + "_over.png");
			},
			function() {
				if($(this).data("origImg")) {
					$(this).attr("src",$(this).data("origImg"));
				} else {
					$(this).attr("src","images/" + this.id + ".png");
				}
			}
		);
	});
});
