(function($) {
	 
	$.fn.labelAsValue = function()
	{
		return this.each(function()
		{
			var $label = $(this);
			
			var $input = $label.find('input[type="text"],input[type="password"],textarea');
			
			if ($input.size())
			{
				var $span = $label.find('span')

				// Remove span (containing the label) if we have a value,
				// to prevent it from colliding with the value of the input
				if ($input.val() != '')
				{
					$span.remove();
				}

				$input.focus(function()
				{
					$span.fadeOut('fast',function()
					{
						$span.css({'left':'-999em'});
					});
				}
				).blur(function()
				{
					if ($(this).val() == '')
					{
						$span.removeAttr('style');
					}
				});
			}	
		});
	};
	
})(jQuery);