
var PhantomLabels = new Class({

	options: {
		className: 'hideme'
	},

	initialize: function(el){
		this.label = $(el);
		var element = this.label.getProperty('for');
		this.input = $(element);
		if (this.input) {
			this.input.addEvent('focus', this.hideLabel.bind(this)).addEvent('blur', this.checkLabel.bind(this));
			this.checkLabel();
		}
	},

	hideLabel: function(){
		this.label.addClass(this.options.className);
	},

	checkLabel: function() {
		if (this.input.value === '' && this.label.hasClass(this.options.className)) {
			this.label.removeClass(this.options.className);
		}
	}

});