/**
* linkNotify v1.1 // 2009.06.10
* <http://briancray.com/2009/06/09/jquery-plugin-linknotify-inline-link-click-notification/>
* 
* @author    Brian Cray <webmail@briancray.com>
*/
/*
(function($) {
	$.fn.linkNotify = function (notification) {
		notification = notification || 'Loading&hellip;';
		this.not('[href^="#"]').each(function () {
			$(this).click(function () {
				$(this).html(notification);
			});
		});
		return this;
	};
})(jQuery);
*/
/**
* linkNotify v2.0 // 2009.12.15
* <http://briancray.com/2009/12/15/user-feedback-clicked-links-linknotify-2/>
* 
* default use: $('a').linkNotify();
* change selector: $('#content a').linkNotify();
* change progress bar color: $('a').linkNotify('#ff0000');
*
* @author    Brian Cray <bcrayzie@gmail.com>
*/

(function($) {
	$.fn.linkNotify = function (notification, progressbarcolor) {
		if (notification != "0") {
			progressbarcolor	= progressbarcolor || '#eeeeee';
			notification		= notification || 'Loading&hellip;';
		
			var ignore = false;
			$(document).keydown(function () {
				ignore = true;
			}).keyup(function () {
				ignore = false;
			});
			this.not('[href^="#"]').not(':has(img)').each(function () {
				$(this).click(function () {
					$(this).html(notification);
					if(ignore == true)
					{
						return;
					}
					
					var $thisel = $(this);
					var $thisoff = $thisel.offset();
					$('<div></div>').appendTo('body').css({'position': 'absolute', 'z-index': '-1', 'top': $thisoff.top, 'left': $thisoff.left, 'width': '0', 'height': $thisel.height(), 'background-color': progressbarcolor}).animate({'width': $thisel.width()}, 5000);
				});
			});
			return this;
		}
	};
})(jQuery);
