$(document).ready(function() {

	$("ul.gallery li").hover(function() { //On hover...

		var thumbOver = $(this).find("img").attr("src"); //Get image url and assign it to 'thumbOver'

		//Set a background image(thumbOver) on the <a> tag - Set position to bottom
		$(this).find("a.thumb").css({'background' : 'url(' + thumbOver + ') no-repeat center bottom'});

		//Animate the image to 0 opacity (fade it out)
		$(this).find("span").stop().animate({opacity: 0}, 300);

	} , function() { //on hover out...

		//Animate the image back to 100% opacity (fade it back in)
		$(this).find("span").stop().animate({opacity: 1}, 300);

	});

});