/*
 * 	Simple JavaScript Library
 *  (c) 2007 Simple Adaptation
 *  
 *  Author: Michael Duff, Simple Adaptation
 *  AutoClearInput.js, version .8.3
 *
/*-------------------------------------------------------------------*/

var AutoClearInput = new Class({
						 
	initialize: function(className) {
		this.className = className;
		var actionItems = $$('.'+this.className);
		
		$each(actionItems, function(el){
			el.InputTextDefault = el.value;
			el.addEvent('focus', this._clearInput.bindWithEvent(this, el));
			el.addEvent('blur', this._updateInput.bindWithEvent(this, el));			 
		}, this);
		
	},
	
	_clearInput: function(event, el) {
		if(el.value == el.InputTextDefault) { el.value=""; }
	},
	
	_updateInput: function(event, el) {
		if(el.value == "") { el.value=el.InputTextDefault; }
	}						 

});