 $(function() {
	$('#topnav').find('img').each(function() {
		
		var src = $(this).attr('src');
    var ext = src.substring( src.lastIndexOf('.'), src.length ); // get the file extension
    var hsrc = src.replace( ext, '_r' + ext ); // store the rollover src		
    $(this).attr('id',hsrc);

    // Preload the image
    preLoad = new Image();
    preLoad.src = hsrc;
		
		$(this).mouseenter(function() {
      tempSrc = $(this).attr('src');
			$(this).attr('src',$(this).attr('id'));	
		});
		
		$(this).mouseleave(function() {
      if (!tempSrc) tempSrc = $(this).attr('src').replace('_r'+ftype, ftype);
      $(this).attr('src', tempSrc);			
		});
		
	});	
 })
