(function($) {

  $.fn.toggleVal = function(blurClass, hideLabels) {
  	this.each(function() {

  	  var _this = $(this);
  	  
  	  var defaultValue = _this.val();
    	_this.addClass(blurClass);

  		_this.focus(function() {
  			if (_this.val() === defaultValue) {
  			  _this.val('');
    			if (blurClass) {
    			  _this.removeClass(blurClass);
    			}
  			}
  		}).blur(function() {
  			if (_this.val() === '') {
  			  _this.val(defaultValue);
    			if (blurClass) {
    			  _this.addClass(blurClass);
    			}
  			}
  		}).trigger('blur');

  		if (hideLabels == true) {
    		$('label[for=' + this.id + ']').hide();
  		}
  	});
  };
  
})(jQuery);


