 (function($){
	$.fn.linkControl = function(options){

		var defaults = {
			padding: 5,
			bgColor: '#fff',
			borderColor: '#333',
			inline: false,
			overlay: false
		};

		var options = $.extend(defaults, options);

		var linky = '';
		var currentText = '';

		var element = this;

		return this.each(function(){

			if(options.inline === true){
				$(this).hover(
					function(over){
						linky = $(this).attr('href');
						currentText = $(this).text();
						$(this).removeAttr('href');

						$(this).html('<a href="' + linky + '">' + currentText + '</a> - Open link in <a alt=\"'+ currentText +'\" href=\"' + linky + '" target=\"blank\" class=\"optionsOver\"> New Window</a>');
					},

					function(out){
						$(this).html(currentText).attr('href',linky);
					}
				); // end this.hover
			} // end options.inline

			if(options.overlay === true){
				$(this).hover(
					function(over){
						linky = $(this).attr('href');
						currentText = $(this).text();
						$(this).removeAttr('href');
						var w = $(this).width();

						$(this).css('position','relative');
						$(this).html(currentText + '<div id="link-text" style="position:absolute; display:block; border-right:none; z-index:10; background:' + options.bgColor + '; border:' + options.borderColor + ' 1px solid; border-right:none;">' + currentText + ':</div><span style="width:120px; position:absolute; top:-' + (options.padding+1) + 'px; left:' + (w+options.padding*2) + 'px; padding:' + options.padding + 'px; background:' + options.bgColor + '; border:' + options.borderColor + ' 1px solid; z-index:9;">Open link in <br /><a alt=\"'+ currentText +'\" href=\"' + linky + '" target="blank"> New Window</a> or <br /><a href=\"' + linky + '"> Current Window</a></span>');

						$('#link-text').css({
							top: '-' + (options.padding+1) + 'px',
							left: '-' + (options.padding+1) + 'px',
							padding: options.padding,
							paddingRight: options.padding+1,
							width: (w+options.padding)
						});
					},

					function(out){
						$(this).html(currentText).attr('href',linky);
					}
				);
			} // options.overlay

		}); // end this.each

	}; // end fn.linkControl

})(jQuery);
