//$(document).ready(function( ) {
//	$(document).ready(function( ) {
//	$('table.striped td').addClass('even');
//	$('table.striped tbody td').mouseover(function() {
//			$(this).addClass('highlight');
//			$(this).css('cursor','pointer');
//	}).mouseout(function() {
//			$(this).removeClass('highlight');
//	});
//});

$('#gallery img').each(function(i) {
	var imgFile = $(this).attr('src');
	var preloadImage = new Image();
  var imgExt = /(\.\w{3,4}$)/;
  preloadImage.src = imgFile.replace(imgExt,'bw');
		
	$(this).hover(
		function() {
			$(this).attr('src', preloadImage.src);
		},
		function () {
		var currentSource=$(this).attr('src');
			$(this).attr('src', imgFile);
	}); // end hover
}); // end each


	$('#gallery a').click(function(evt) {
		//don't follow link
		 evt.preventDefault();
		 //get path to new image
	   var imgPath = $(this).attr('href');
		 //get reference to old image
		 var oldImage = $('#gallery img');
		 //check to see if they're the same image
	
			
			 //create HTML for new image
			 var newImage = $('<img src="' + imgPath +'">');
			 //make new image invisible
			 newImage.hide();
			 //add to the #photo div
			 $('#gallery').prepend(newImage);
			 //fade in new image
			 newImage.slideToggle(500);
			 
			 //fade out old image and remove from DOM
			 oldImage.fadeIn(5000,function(){
		     $(this).remove();
				});
			 
		 
	}); // end click
		
		$('#gallery a:first').click();
//   }); // end ready


