// jQuery pulse plugin
// pulses elements between CSS prop objects propStart and propEnd
// Licensed under WTFPL
// created by charles@doublerebel.com

(function ($) {
	var _recursivePulse = function($el, o, cb) {
		if (o.cycles-- > 0)
			$el.animate(o.propStart, o.speed, o.easing).animate(o.propEnd, o.speed, o.easing,  function() { _recursivePulse($el, o, cb); });
		else cb && cb.apply($el);
	};
	$.fn.extend({
		pulse: function(o, cb) {
			o = $.extend(true,{
				speed: 250,
				easing: "swing",
				cycles: 3,
				propStart: {
					opacity: 0.3
				},
				propEnd: {
					opacity: 1
				}
				}, o || {});
			_recursivePulse(this, o, cb);
			return this;
		}
	});
})(jQuery);
