(function($)
{
	// Usage:
	// $('#myinput').defaultText('Default text here');
	$.fn.defaultText = function(text)
	{
		var $fi = $(this);
		var $fo = $fi.parents('form');
		
		// Set the default text if not already
		if ($fi.val() == '')
		{
			$fi.val(text);
		}
		
		// React depending on presence of default text
		$fi.focus(function()
		{
			if ($fi.val() == text)
			{
				$fi.val('');
			}
		}).blur(function()
		{
			if ($fi.val() == '')
			{
				$fi.val(text);
			}
		});
		
		// Make sure default text gets sent as nothing instead
		$fo.submit(function()
		{
			if ($fi.val() == text)
			{
				$fi.val('');
			}
		});
		
		return this;
	};
	
	// Usage:
	// $('#mylink').hoverFade({ opcIn: opacityOnMouseOver, opcOut: opacityOnMouseOut, speed: fadeSpeed });
	$.fn.hoverFade = function(options)
	{
		var defaults = {
			opcIn: 1.0, 
			opcOut: 0.5, 
			speed: 100
		}, 
			settings = $.extend(defaults, options);
		
		this.each(function()
		{
			var $t = $(this);
			
			$t.css('opacity', settings.opcOut).hover(function()
			{
				// Mouse over, fade in to this opacity
				$t.animate({ opacity: settings.opcIn }, settings.speed);
			}, function()
			{
				// Mouse over, fade out to that opacity
				$t.animate({ opacity: settings.opcOut }, settings.speed);
			});
		});
		
		return this;
	};
	
	// Usage:
	// $('#myelm').animate(fancyAnimationObject).idle(timeMilliseconds).animate(anotherFancyAnimationObject);
	$.fn.idle = function(time)
	{ 
		var $t = $(this);
		
		$t.queue(function()
		{
			setTimeout(function()
			{
				$t.dequeue();
			}, time);
		});
		
		return this;
	};
// I think self-invoking closures are cute
})(jQuery);