// JavaScript Document
function initInputNamed() {
  var inputs = document.getElementsByTagName("INPUT");
  for(var no=0;no<inputs.length;no++){
	if(inputs[no].getAttribute('named')=="true") {
	  inputs[no].blur();
	  inputs[no].onfocus = inputs[no].onselect = inputs[no].onclick = function () {
		if(!this.valueBck) {
		  this.valueBck = this.value;
		  this.value = '';
		  this.focus();
		}
		if(this.getAttribute("typeOnFocus")) {
		  vInp = document.createElement("INPUT");
		  vInp.type = this.getAttribute('typeOnFocus');
		  vInp.valueBck = this.valueBck;
		  if(this.name) vInp.name = this.name;
		  if(this.id) vInp.id = this.id;
		  if(this.value) vInp.value = this.value;
		  if(this.className) vInp.className = this.className;
		  if(this.title) vInp.title = this.title;
		  //if(this.style) vInp.style = this.style;
		  if(this.size) vInp.size = this.size;
		  if(this.maxLength&&this.maxLength!=-1) vInp.maxLength = this.maxLength;
		  this.parentNode.replaceChild(vInp,this);
		  setTimeout('vInp.focus()',130);
		  vInp.onblur = function () {
			if(this.value.length==0) {
			  vInpTxt = document.createElement("INPUT");
		      vInpTxt.setAttribute('typeOnFocus',this.type);
			  vInpTxt.setAttribute('type','text');
			  vInpTxt.setAttribute('named','true');
		      vInpTxt.valueBck = this.valueBck;
			  if(this.name) vInpTxt.name = this.name;
			  if(this.id) vInpTxt.id = this.id;
			  if(this.value) vInpTxt.value = this.value;
			  if(this.className) vInpTxt.className = this.className;
		 	  if(this.title) vInpTxt.title = this.title;
			  //if(this.style) vInp.style = this.style;
			  if(this.size) vInpTxt.size = this.size;
			  if(this.maxLength&&this.maxLength!=-1) vInpTxt.maxLength = this.maxLength;
			  this.parentNode.replaceChild(vInpTxt,this);
			  vInpTxt.value = vInpTxt.valueBck;
			  vInpTxt.valueBck = '';
			  initInputNamed();
			}
		  };
		}
	  };
	  inputs[no].onblur = function () {
	    if(this.value.length==0) {
		  this.value = this.valueBck;
		  this.valueBck = '';
		}
	  };
	}
  }
}

if(window.addEventListener)
  window.addEventListener("load", initInputNamed, true)
if(window.attachEvent)
  window.attachEvent("onload", initInputNamed)