/**
 * jQuery Placeholder plugin:
 * Swaps input field text with placeholder on blur/focus
 *
 * @version 1.0
 * @author Zach Waugh <zwaugh@gmail.com>
 * http://zachwaugh.com/projects/jquery-plugins/placeholder.html
 * 
 * Copyright (c) 2009 Zach Waugh
 * Licensed under the MIT License - http://www.opensource.org/licenses/mit-license.html
 */

(function($)
{
	$.fn.placeholder = function()
	{
		return this.each(function()
		{
			// Remove default text on focus
			$(this).focus(function()
			{
			  if ($(this).val() == $(this).attr('defaultValue'))
			  {
			  	$(this).val('');
			  }
			})
			
			$(this).blur(function()
			{
				if ($(this).val() === '')
				{
					$(this).val($(this).attr('defaultValue'));
				}
			});
		});
	}
})(jQuery);
