jQuery.fn.defaultValue = function(text, klass){
  return this.each(function(){
    if (this.type != 'text' && this.type != 'password' && this.type != 'textarea')
    return;

    // Store field reference
    var fld_current = this;

    // Set value initially if none are specified
    if ($(this).val() == '') {
      $(this).val(text);
    } else {
      // Other value exists – ignore
      return;
    }

    // Add class on focus
    $(this).focus(function() {
      if ($(this).val() == text || $(this).val() == '') {
        if (klass != null) {
          $(this).addClass(klass);          
        }
        $(this).val('');
      }
    });

    // Remove class on blur
    $(this).blur(function() {
      if ($(this).val() == text || $(this).val() == '') {
        if (klass != null) {        
          $(this).removeClass(klass);
        }
        $(this).val(text);
      }
    });

  });
};
