(function($){
	$.fn.fadeToggle = function(s, fn){
	  if(undefined == s) {
	    s = 300;
	  }
	  return (this.is(":visible"))
	  ? this.fadeOut(s, fn)
	  : this.fadeIn(s, fn);
	};

	$.fn.backgroundFlash = function(color) {
		var defaults = {
			speedIn: 400,
			speedOut: 1000,
			easing: 'linear'
		};
		var options = $.extend(defaults, options);

		var oldColor = this.css('background-color');
		if(
			undefined == oldColor ||
			"transparent" == oldColor.toLowerCase() ||
			"inherit" == oldColor.toLowerCase() ||
			"none" == oldColor.toLowerCase()
		) {
			oldColor = "#FFFFFF";
		}

		this.animate(
			{backgroundColor : color},
			{'duration' : options.speedIn}, 
			options.easing).animate(
				  {backgroundColor : oldColor},
					{'duration' : options.speedOut},
					{'easing' : options.easing}
			);
	};

})(jQuery);
