/**
* 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 (progressbarcolor) {
		progressbarcolor = progressbarcolor || '#eeeeee';
		
		var ignore = false;
		$(document).keydown(function () {
			ignore = true;
		}).keyup(function () {
			ignore = false;
		});
			
		this.not('[href^="#"]').not(':has(img)').each(function () {
			$(this).click(function () {
				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);

