function init() {
 var inputs = document.getElementsByTagName('input');
 for(var i=0; i < inputs.length; i++) {
  if (inputs[i].type == 'text' || inputs[i].type=='password' ) {
   inputs[i].setAttribute('rel',inputs[i].defaultValue);
   inputs[i].onfocus = function() {
    if (this.value == this.getAttribute('rel')) {
     this.value = '';
    } else {
     return false;
    }
   }
   inputs[i].onblur = function() {
    if(this.value=='') { 
     this.value = this.getAttribute('rel');
    } else {
     return false;
    }
   }
   inputs[i].ondblclick = function() {
    this.value = this.getAttribute('rel')
   }
  }
 }
}
 
if(document.childNodes) {
 window.onload = init;
}
