;(function($){
	$.fn.clearText = function(o){
		
		o = $.extend({}, {
		  onFocus: function() {},
		  onBlur: function() {}		  
		}, o);
		
		return this.each(function() {
			var $$ = $(this);

			if ($$.attr('type') == 'text' || $$.attr('type') == 'textarea') {  
          		$$.val() != '' ? $.data(this, 'defaultText', $$.val()) : $.data(this, 'defaultText', null);

				$$.bind('focus', function() {
				    if (this.value == $.data(this, 'defaultText')) {
						this.value = '';
					}	
					o.onFocus($$);
				});
				$$.bind('blur', function() {
					if (this.value == '' && $.data(this, 'defaultText') != null) {
						this.value = $.data(this, 'defaultText');
					}				
					o.onBlur($$);					
				});
			}
			
		});
	};
})(jQuery);