/* 
 * SmartBlur Plugin 1.0
 * Focus-clear and blur-restore for input fields and textareas
 *
 * @author Ben Plum <bplum@gmail.com>
 * @version 1.0
 *
 * Copyright (c) 2009 Ben Plum MIT License
 *
 * UPDATE 10/31/09: Added textarea functionality
 */

(function($){
	$.fn.smartBlur = function()
	{	
		//clear field on focus
		$(this).focus(function(){
			if($(this).val() == $(this).attr('defaultValue'))
	        	$(this).val('');
		});
		//restore on blur
		$(this).blur(function(){
			if($(this).val() == '')
        		$(this).val($(this).attr('defaultValue'));
		});
	}
})(jQuery);
