Hint = Class.create();
Hint.prototype = {
	initialize: function(target, msg) {
		this.target = target;
		this.msg = msg;

		if (this.target.value=="" || this.target.value==this.msg) {
			this.target.value=this.msg; 
			this.target.style.color="#999999";
		}
								
		Event.observe($(target), "focus", this.clear.bind(this));
		Event.observe($(target), "blur", this.restore.bind(this));		
	}, 
	
	clear: function(event) {
		if (this.target.value==this.msg) {
			this.target.value="";
			this.target.style.color="#000000";
			this.target.select();
		}	
	},

	restore: function(event) {
		if (this.target.value=="") {
			this.target.value=this.msg; 
			this.target.style.color="#999999";
		}	
	}
}