var GhostInput = new Class( {
	Implements : [ Options, Events ],

	initialize : function(elements, options) {
		elements.each(function(element) {
			new GhostInput.Input(element);
		});
		this.setOptions(options);
	}
});

GhostInput.Input = new Class( {
	Implements : [ Options, Events ],
	options : {
		gClass: 'ghost-input'
	},

	initialize : function(element, options) {
		this.setOptions(options);
		this.el = element;
		this.text = this.el.getNext().value;
		if(this.el.value != this.text) {
			this.el.removeClass(this.options.gClass);
		}
		this.el.addEvents({
			'focus': this.empty.bind(this),
			'blur': this.reset.bind(this)
		});
	},

	empty : function(e) {
		if(this.el.value == this.text) {
			this.el.set('value', '');
			this.el.removeClass(this.options.gClass);
		}
	},
	
	reset : function(e) {
		if(this.el.value == '') {
			this.el.set('value', this.text);
			this.el.addClass(this.options.gClass);
		}
	}
});