// vim: set expandtab tabstop=3 shiftwidth=3 foldmethod=marker:
// ------------------------------------------------------------
//   Author: Brian Clark (brian@spamcop.net)
//     File: js/util.js
//  Created: 01:21:13 AM EDT Fri, June 26, 2009
// Modified: 08:17:37 PM EDT Thu, June 24, 2010
// ------------------------------------------------------------
function hlite() {
   $(this).attr('src', $(this).attr('src').replace('off','on'));
}
function dlite() {
   $(this).attr('src', $(this).attr('src').replace('on','off'));
}

// 'o' must be an object
function clickClearField(o) {
   this.fieldObj = o;   
   this.defaultValue = o.attr('value');
   var _this = this; 
   // Don't know why the following doesn't work:
   // E.g. o.bind('focus', _this.setDefaultValue);
   // So I have to do this ugly mess instead.
   o.bind('focus', function(e) { _this.clearDefaultValue(); });
   o.bind('blur',  function(e) { _this.setDefaultValue();   });
   return;
}
clickClearField.prototype.clearDefaultValue = function() {
   if (this.defaultValue == '') return;
   if (this.fieldObj.attr('value') == this.defaultValue) {
      this.fieldObj.attr('value','');
   }
   return;
}
clickClearField.prototype.setDefaultValue = function() {
   if (this.defaultValue == '') return;
   if (jQuery.trim(this.fieldObj.attr('value')) == '') {
      this.fieldObj.attr('value', this.defaultValue);
   }
   return;
}



