if (window.addEventListener){
	window.addEventListener("load", initInputs, false);
	}
else if (window.attachEvent){
	window.attachEvent("onload", initInputs);
}

function initInputs()
{
	var inputs = document.getElementsByTagName("input");
	var _val = [];
	for (var i=0; i<inputs.length; i++)
	{
		if (inputs[i].type == "text"){
			_val[i] = inputs[i].value;
			inputs[i].index = i;
			inputs[i].onfocus = function(){
				if(_val[this.index] == this.value) this.value = '';
			}
			inputs[i].onblur = function(){
				if(_val[this.index] == this.value || this.value == '') this.value = _val[this.index];
			}
		}
	
		if (inputs[i].type == "password"){
			_val[i] = inputs[i].value;
			inputs[i].index = i;
			inputs[i].onfocus = function(){
				if(_val[this.index] == this.value) this.value = '';
			}
			inputs[i].onblur = function(){
				if(_val[this.index] == this.value || this.value == '') this.value = _val[this.index];
			}
		}
	}
}
if (window.addEventListener){
	window.addEventListener("load", initInputs, false);
	}
else if (window.attachEvent){
	window.attachEvent("onload", initInputs);
}
