/////////////////////////////////////////////////////////////////////////////////
(function($)
{
	
	$.fn.defaultTextWithTitle = function(text,text2)
	{
		var $fi = $(this);
		var $fo = $fi.parents('form');
		
		// Set the default text if not already
		if ($fi.val() == '' || $fi.val() == text)
		{
			$fi.val(text2);
		}
		
		// React depending on presence of default text
		$fi.focus(function()
		{
			if ($fi.val() == '' || $fi.val() == text2)
			{
				$fi.val(text);
			}
		}).blur(function()
		{
			if ($fi.val() == '' || $fi.val() == text)
			{
				$fi.val(text2);
			}
		});
		
		// Make sure default text gets sent as nothing instead
		$fo.submit(function()
		{
			if ($fi.val() == text || $fi.val() == text2 )
			{
				$fi.val('');
			}
		});
		
		return this;
	};
	//////////////////////////////////////////
	
	$.fn.defaultText2 = 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() == '')
			{
				$fi.val(text);
			}
		}).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;
	};
	//////////////////////////////////////////
	
	
	
	$.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;
	};
	
	$.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()
			{
				$t.animate({ opacity: settings.opcIn }, settings.speed);
			}, function()
			{
				$t.animate({ opacity: settings.opcOut }, settings.speed);
			});
		});
		
		return this;
	};
	
	$.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);
//////////////////////////////////////////////////////////////////////////	$('#sub-name input').defaultText('Your name').prev().text('');
////////////////////////
