var ie = (/MSIE\s((5\.5)|[6789])/.test(navigator.userAgent)) && (navigator.platform == "Win32");
var ie5 = /MSIE 5\.0/.test(navigator.userAgent) && navigator.platform == "Win32";

function png(id, src_png, src_gif){  
	image = document.getElementById(id);
	if (ie5) {image.src = src_gif;}
	else {
		if(!ie){image.src = src_png;}
		else {
			image.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +  src_png + "',sizingMethod='image')"
		}
	}
	return 1;
}


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 = 'full'}
}

inputText.prototype.onKeyDown = function() {this.Input.className = 'full'}

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 = ''}
}

