(function($) {
	$.fn.targetContainer = function(target){
		$(this).each(function(){
			$(this).children('li').children('a')[($.fn.hoverIntent) ? 'hoverIntent' : 'hover' ](function(i) {
				_a = $(this);
				var _thumb = $(this).children('img');
				var _src = _a.attr('href');
				var _title = _thumb.attr('title');
				var _target = $(target + ' img');
				
				if ($(_target).attr("src") != _src) { 
					var _img = new Image();
					$(_target).fadeOut(500);
					$(_target).remove();
					$(target).append("<div class='loading' />");
					$(_img).load(function(){
						$(_target).stop();
						$(this).hide();
						$(target + ' .loading').remove();
						$(target).append(this);
						$(this).fadeIn(1500);
					}).attr({
						src: _src,
						title: _title,
						alt: _title
					});
					$(this).click(function(){ 
						return false; 
					});
				} else {
					$(this).click(function(){ 
						return false; 
					});
				}
			},
				function(i) {
					return false;
			});
		});
	};
})(jQuery);
