(function(n,t,i){var it="TEXTAREA",rt="function",g="password",c="maxLength",v="type",r="",u=!0,tt="placeholder",o=!1,nt="watermark",h=nt,s="watermarkClass",k="watermarkFocus",a="watermarkSubmit",p="watermarkMaxLength",e="watermarkPassword",f="watermarkText",l=/\r/g,ft=/^(button|checkbox|hidden|image|radio|range|reset|submit)$/i,d="input:data("+h+"),textarea:data("+h+")",b=":watermarkable",w=["Page_ClientValidate"],y=o,ut=tt in document.createElement("input");n.watermark=n.watermark||{version:"3.1.4",runOnce:u,options:{className:nt,useNative:u,hideBeforeUnload:u},hide:function(t){n(t).filter(d).each(function(){n.watermark._hide(n(this))})},_hide:function(n,i){var a=n[0],b=(a.value||r).replace(l,r),h=n.data(f)||r,w=n.data(p)||0,y=n.data(s),o,u;h.length&&b==h&&(a.value=r,n.data(e)&&(n.attr(v)||r)==="text"&&(o=n.data(e)||[],u=n.parent()||[],o.length&&u.length&&(u[0].removeChild(n[0]),u[0].appendChild(o[0]),n=o)),w&&(n.attr(c,w),n.removeData(p)),i&&(n.attr("autocomplete","off"),t.setTimeout(function(){n.select()},1))),y&&n.removeClass(y)},show:function(t){n(t).filter(d).each(function(){n.watermark._show(n(this))})},_show:function(t){var w=t[0],nt=(w.value||r).replace(l,r),i=t.data(f)||r,b=t.attr(v)||r,d=t.data(s),h,o,a;nt.length!=0&&nt!=i||t.data(k)?n.watermark._hide(t):(y=u,t.data(e)&&b===g&&(h=t.data(e)||[],o=t.parent()||[],h.length&&o.length&&(o[0].removeChild(t[0]),o[0].appendChild(h[0]),t=h,t.attr(c,i.length),w=t[0])),(b==="text"||b==="search")&&(a=t.attr(c)||0,a>0&&i.length>a&&(t.data(p,a),t.attr(c,i.length))),d&&t.addClass(d),w.value=i)},hideAll:function(){y&&(n.watermark.hide(b),y=o)},showAll:function(){n.watermark.show(b)}},n.fn.watermark=n.fn.watermark||function(i,y){var d="string",w,p;return this.length?(w=o,p=typeof i==d,p&&(i=i.replace(l,r)),typeof y=="object"?(w=typeof y.className==d,y=n.extend({},n.watermark.options,y)):typeof y==d?(w=u,y=n.extend({},n.watermark.options,{className:y})):y=n.watermark.options,typeof y.useNative!=rt&&(y.useNative=y.useNative?function(){return u}:function(){return o}),this.each(function(){var et="dragleave",ot="dragenter",ft=this,o=n(ft),st,d,nt,rt;if(o.is(b)){if(o.data(h))(p||w)&&(n.watermark._hide(o),p&&o.data(f,i),w&&o.data(s,y.className));else{if(ut&&y.useNative.call(ft,o)&&(o.attr("tagName")||r)!==it){p&&o.attr(tt,i);return}o.data(f,p?i:r),o.data(s,y.className),o.data(h,1),(o.attr(v)||r)===g?(st=o.wrap("<span>").parent(),d=n(st.html().replace(/type=["']?password["']?/i,'type="text"')),d.data(f,o.data(f)),d.data(s,o.data(s)),d.data(h,1),d.attr(c,i.length),d.focus(function(){n.watermark._hide(d,u)}).bind(ot,function(){n.watermark._hide(d)}).bind("dragend",function(){t.setTimeout(function(){d.blur()},1)}),o.blur(function(){n.watermark._show(o)}).bind(et,function(){n.watermark._show(o)}),d.data(e,o),o.data(e,d)):o.focus(function(){o.data(k,1),n.watermark._hide(o,u)}).blur(function(){o.data(k,0),n.watermark._show(o)}).bind(ot,function(){n.watermark._hide(o)}).bind(et,function(){n.watermark._show(o)}).bind("dragend",function(){t.setTimeout(function(){n.watermark._show(o)},1)}).bind("drop",function(n){var i=o[0],t=n.originalEvent.dataTransfer.getData("Text");(i.value||r).replace(l,r).replace(t,r)===o.data(f)&&(i.value=t),o.focus()}),ft.form&&(nt=ft.form,rt=n(nt),rt.data(a)||(rt.submit(n.watermark.hideAll),nt.submit?(rt.data(a,nt.submit),nt.submit=function(t,i){return function(){var r=i.data(a);n.watermark.hideAll(),r.apply?r.apply(t,Array.prototype.slice.call(arguments)):r()}}(nt,rt)):(rt.data(a,1),nt.submit=function(t){return function(){n.watermark.hideAll(),delete t.submit,t.submit()}}(nt))))}n.watermark._show(o)}})):this},n.watermark.runOnce&&(n.watermark.runOnce=o,n.extend(n.expr[":"],{data:n.expr.createPseudo?n.expr.createPseudo(function(t){return function(i){return!!n.data(i,t)}}):function(t,i,r){return!!n.data(t,r[3])},watermarkable:function(n){var t,i=n.nodeName;return i===it?u:i!=="INPUT"?o:(t=n.getAttribute(v),!t||!ft.test(t))}}),function(t){n.fn.val=function(){var u=this,o=Array.prototype.slice.call(arguments),e;return u.length?o.length?(t.apply(u,o),n.watermark.show(u),u):u.data(h)?(e=(u[0].value||r).replace(l,r),e===(u.data(f)||r)?r:e):t.apply(u):o.length?u:i}}(n.fn.val),w.length&&n(function(){for(var u,r,i=w.length-1;i>=0;i--)u=w[i],r=t[u],typeof r==rt&&(t[u]=function(t){return function(){return n.watermark.hideAll(),t.apply(null,Array.prototype.slice.call(arguments))}}(r))}),n(t).bind("beforeunload",function(){n.watermark.options.hideBeforeUnload&&n.watermark.hideAll()}))})(jQuery,window)