function inputText (input, dft_value, cssFilled, cssEmpty){
	var thisCopy = this;
	this.Input = input;
	this.dft_Value = dft_value;
	this.CssFilled = cssFilled;
	this.CssEmpty = cssEmpty;

	this.setupEvent (this.Input, 'focus', function() {return thisCopy.onFocus()});
	this.setupEvent (this.Input, 'blur',  function() {return thisCopy.onBlur()});
	this.setupEvent (this.Input, 'keydown', function() {return thisCopy.onKeyDown()});

    if (input.value == dft_value) this.onBlur()
    return this
}

inputText.prototype.setupEvent = function (elem, eventType, handler) {
	if (elem.attachEvent){elem.attachEvent ('on' + eventType, handler)} //IE
	if (elem.addEventListener){elem.addEventListener (eventType, handler, false)} //DOM
}

inputText.prototype.onFocus = function() {
	if (this.Input.value == this.dft_Value) {this.Input.value = ''}
	else {this.Input.className = 'textfield'}
}

inputText.prototype.onKeyDown = function() {this.Input.className = 'textfield'}

inputText.prototype.onBlur = function() {
	if (this.Input.value == '' || this.Input.value == this.dft_Value)
	{
		this.Input.value = this.dft_Value;
		this.Input.className = this.CssEmpty
	}
	else {this.Input.className = 'textfield'}
}
