$(function() {
   $('input.smartBlur').smartBlur();
	$('form').submit(function() {
		$('input.smartBlur').clearSmartBlur();
	});
});

$.fn.smartBlur = function() {
	return this.focus(function() {
		if (this.value == this.defaultValue) {
			this.value = '';
		}
	}).blur(function() {
		if (!this.value.length) {
			this.value = this.defaultValue;
		}
	});
};

$.fn.clearSmartBlur = function() {
	jQuery.each(this, function() {
		if (this.value == this.defaultValue) {
			this.value = '';
		}
	});
};