(function ($) {
	$.fn.defaultValue = function () {
		return this.each(function () {
			var t = $(this);
			var tt = $.trim(t.parents('form').find('label[for="' + t.attr('id') + '"]').text());
			if (t.is(':input') && tt.length > 0) {
				t.data('defaultValue', tt);
				var h1 = function (e) {
					var v = $.trim(t.val());
					var el = $(this);
					switch (e.type) {
						case 'blur':
							if (v.length == 0 || v == tt) {
								el.addClass('defaultValueBlur').val(tt);
							}
							break;
						case 'focus':
							if (v == tt) {
								el.removeClass('defaultValueBlur').val('');
							}
							break;
					}
				};
				var h2 = function (e) {
					var v = $.trim(t.val());
					if (v == tt) {
						t.removeClass('defaultValueBlur').val('');
					}
				};
                $(['focus', 'blur']).each(function () {
                    t.bind(this + '.defaultValue', h1);                    
                });
				t.trigger('blur.defaultValue');                
            }                                   
        });              
     };     
})(jQuery);