/* 	Function: 	Enlarge an image when it is hovered over
	Author: 	Justin Farmer 
*/

$(document).ready(function() {
	var mpx = 2.2;						   
	$('img.enlarge').each(function() {
		var data = $(this).metadata();
		var oWidth = $(this).width();
		var oHeight = $(this).height();
		$(this)
			.bind("click", data, function(event) {
				$(this)
					.stop()
					.addClass("hover")
					.oneTime(100, function() {
						$(this).animate({
							width: (oWidth * mpx) +'px',
							height: (oHeight * mpx) +'px',
							top: event.data.top + 'px',
							left: -(oWidth / 2)+'px'
						},350, 'linear');					  
					})
			})
			.bind("mouseout", data, function(event) {
				$(this)
					.stop()
					.animate({
						width: oWidth +'px',
						height: oHeight +'px',
						top: 52 + 'px',
						left: 0
					},250, 'linear', function() {
						$(this).removeClass("hover");	
					})
		});
	});
});
