$(document).ready(function(){
	$('.item').each(function(){
		//options
		var time = 250;
		var hideDelay = 100;
		
		//tracker
		var hideDelayTimer = null;
		var beingShown = false;
		var shown = false;
		
		var target = $(this);
		
		$(this).mouseover(function(){
			
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			
			if (beingShown || shown) {
				return;
			} else {
				beingShown = true;
			
				target.css({
					zIndex:'10'
				}).animate({
					height:'410px',
					width:'250px',
					opacity:'1',
					top:'-80px',
					left:'-5px'
				},time,'swing');
				
				$('img',this).animate({
					marginTop:'5'
				},time,'swing',function() {
					beingShown = false;
					shown = true;
				});
			
			}
		
		}).mouseout(function(){
			
			if (hideDelayTimer) clearTimeout(hideDelayTimer);
			hideDelayTimer = setTimeout(function () {
				hideDelayTimer = null;
				
				target.animate({
					height:'240px',
					width:'240px',
					opacity:'.9',
					top:'0',
					left:'0'
				},time,'swing').css({
					zIndex:'1'
				});
				
				$('img',target).animate({
					marginTop:'-80px'
				},time,'swing',function() {
					beingShown = false;
					shown = false;
				});
				
			}, hideDelay);
				
		});
	});
});
