(function($) {
 
  $.fn.delayedMouseover = function(callback, options) {
 
	var options = $.extend({ delay: 50 }, options);

	return this.each(function() {
		var obj = $(this);
		var timer = false;
		obj.bind("mouseover", function(event) {
			if(timer) clearTimeout(timer);
			timer = setTimeout( function() { 
				callback.apply(obj[0], [event]); 
			}, options.delay );
		});		
		obj.bind("mouseout", function(event) {
			if(timer) clearTimeout(timer);
			timer = false;
		});		
	});
  };

  $.fn.delayedMouseleave = function(callback, options) {
 
	var options = $.extend({ delay: 100 }, options);

	return this.each(function() {
		var obj = $(this);
		var timer = false;
		obj.bind("mouseleave", function(event) {
			if(timer) clearTimeout(timer);
			timer = setTimeout( function() { 
				callback.apply(obj[0], [event]); 
			}, options.delay );
		});		
		obj.bind("mouseover", function(event) {
			if(timer) clearTimeout(timer);
			timer = false;
		});		
	});
  };
 
})(jQuery);
