/*
 * Vorausgefüllte input-Boxen müssen bei Klick geleert und bei Verlassen ohne
 * Ausfüllung wieder mit dem Wert gefüllt werden.
 *
 * @version: $Id: clear-inputs.js 217 2010-03-19 18:54:56Z jelner $
 */
var clear_inputs = new Class({
	old: [],

	initialize: function() {
		var _this = this;
		var els = $$('#suchform input[type="text"]');
		if($chk(els)) {
			els.each(function(el,i) {
				if($chk(el.value) && el.value != '' && !el.value.match(/^\s+$/)) {
					_this.old[i] = el.value;
					el.addEvents({
						'focus': function(e) { if(this.value == _this.old[i]) { this.value = ''; this.removeClass('default'); };},
						'change': function(e) { if(this.value == '' || this.value.match(/^\s+$/)) { this.value = _this.old[i]; this.addClass('default'); };},
						'blur': function(e) { if(this.value == '' || this.value.match(/^\s+$/)) { this.value = _this.old[i]; this.addClass('default'); };}
					});
				};
			});
		};
	}
});

window.addEvent('domready',function() { new clear_inputs(); });