TextfieldHint = {

	apply : function(field, hint){
	
		// Start with default like this
		if ($(field).attr("value") == "") {
			TextfieldHint.showHint(field, hint);
		}
		
		// onBlur, may need to show hint if field is empty		
		$(field).blur(function(){
			if (field.attr("value") == "") {
				TextfieldHint.showHint(field, hint);
			}
		});
		
		// onClick hide the hint if there is still hint text
		$(field).click(function(){
			if (field.attr("value") == hint) {
				TextfieldHint.hideHint(field, hint);
			}
		});

		// onSubmit of the form, may need to remove the hint
		$($(field)[0].form).submit(function(){
			if (field.attr("value") == hint) {
				TextfieldHint.hideHint(field, hint);
			}
		});
	},
	
	showHint : function(field, hint){
		$(field).attr("value", hint);
		$(field)[0].style.color = "gray";
		$(field)[0].style.fontStyle = "italic";
	},
	
	hideHint : function(field, hint) {
		$(field).attr("value", "");
		$(field)[0].style.color = "";
		$(field)[0].style.fontStyle = "";
	}

}