  var hideHint = function(field, text){
    if (jQuery(field).val() === text) {
      jQuery(field).val("");
      jQuery(field).removeClass('hint');
    }
  };
  
  var showHint = function(field, text){
    if (jQuery(field).val() === "") {
      jQuery(field).val(text);
      jQuery(field).addClass('hint');
    }
  };
  
  function register_hints(hints) {
	  var text;
	  for (fieldName in hints) {
	    text = hints[fieldName];
	    jQuery("input[name='"+fieldName+"']").val(text).focus((function(text) {
	      return function() {hideHint(this, text)};
	    })(text)).blur((function(text) {
	      return function() {showHint(this, text)};
	    })(text)).addClass('hint');
	    jQuery("textarea[name='"+fieldName+"']").val(text).focus((function(text) {
		      return function() {hideHint(this, text)};
		    })(text)).blur((function(text) {
		      return function() {showHint(this, text)};
		    })(text)).addClass('hint');
	  }
  };

