(function($) {
	$.extend($.fn, {
		blink : function(options) {
			var blink = new __blink(this, options);
			blink.start();
		}
	});

	function __blink(els, options)
	{
		var that = this,
			config = {
				delay : 350,
				/*
				 * количество итераций. Добавлений класса - одна итерация, удаление класса - еще одна
				 * те чтобы моргнуло 2 раза - нужно 4 итерации, 3 - 6 и тд
				 **/
				quant : 6,
				className : 'blink'
			},
			counter = 0;

		this.start = function()
		{
			els.toggleClass(config.className);
	        counter++;

	        if (counter < config.quant) {
	            setTimeout(function() {
	                that.start();
	            }, config.delay);
	        }
		}

		__setup();

		function __setup()
		{
			if (typeof(options) == 'object' && options) {
				config = $.extend(config, options);
			}
		}
	}
}) (jQuery);

