Element.addMethods('input',{setPlaceHolder:function(obj,text,isPwd){function addHandlers(obj,isPwd){obj=$(obj);obj.showPH=function(isPwd){if(!this.value){var obj=this;if(isPwd)obj=replaceInput(this,'text');$(obj).addClassName('ph');obj.value=$(obj).readAttribute('ph');}}.bind(obj,isPwd);obj.hidePH=function(isPwd){if(this.value==$(this).readAttribute('ph')){var obj=this;if(isPwd)obj=replaceInput(this,'password');$(obj).removeClassName('ph');obj.focus();obj.value='';}}.bind(obj,isPwd);Event.observe(obj,'focus',obj.hidePH);Event.observe(obj,'blur',obj.showPH);}function replaceInput(src,newType){var newObj=document.createElement('input');$(newObj).id=src.id;$(newObj).name=src.name;$(newObj).className=src.className;$(newObj).cssText=src.cssText;$(newObj).type=newType;$(newObj).setAttribute('ph',$(src).readAttribute('ph'));src.parentNode.insertBefore(newObj,src);src.parentNode.removeChild(src);addHandlers($(newObj),true);return newObj;}isPwd=typeof isPwd!='undefined'&&isPwd||obj.type.toLowerCase()=='password';if(obj.type.toLowerCase()!='text'&&!isPwd)return false;$(obj).setAttribute('ph',text);addHandlers($(obj),isPwd);$(obj).showPH();}});
