// JavaScript Document

$(document).ready(function() {
						   
	// create automated image rollovers

	$('.mainnav img, .hp_content_bottom img').each(function() {    // pulls all <img> tags inside div class "mainnav"
	
		var imgFile = $(this).attr('src');    // pulls each image's "src" attribute in turn
		
		var preloadImage = new Image();    // creates preload function
		
		preloadImage.src = imgFile.replace(/1.jpg/, '2.jpg');    // uses "replace" function to make, e.g., "home2.jpg" out of "home.jpg"
		
		$(this).hover(    
		
			function() {    // jQuery "hover" function takes two arguments, first "mouseover" and then "mouseout"
			
				$(this).attr('src', preloadImage.src);
				
			},
			
			function() {
			
				$(this).attr('src', imgFile);
		
			}
		
		); // end "hover"
	
	}); // end "each"
	
						   }); // end "ready"