(function(t){"use strict";t.Placeholders={Utils:{addEventListener:function(t,e,r){return t.addEventListener?t.addEventListener(e,r,!1):t.attachEvent?t.attachEvent("on"+e,r):void 0},inArray:function(t,e){var r,n;for(r=0,n=t.length;r<n;r++)if(t[r]===e)return!0;return!1},moveCaret:function(t,e){var r;t.createTextRange?((r=t.createTextRange()).move("character",e),r.select()):t.selectionStart&&(t.focus(),t.setSelectionRange(e,e))},changeType:function(t,e){try{return t.type=e,!0}catch(t){return!1}}}}})(this),function(t){"use strict";function e(){}function r(){try{return document.activeElement}catch(t){}}function n(t,e){var r,n,a=!!e&&t.value!==e,u=t.value===t.getAttribute(N);return(a||u)&&"true"===t.getAttribute(S)&&(t.removeAttribute(S),t.value=t.value.replace(t.getAttribute(N),""),t.className=t.className.replace(T,""),n=t.getAttribute(k),0<=parseInt(n,10)&&(t.setAttribute("maxLength",n),t.removeAttribute(k)),(r=t.getAttribute(w))&&(t.type=r),!0)}function a(t){var e=t.getAttribute(N);return!(""!==t.value||!e)&&(t.setAttribute(S,"true"),t.value=e,t.className+=" "+L,t.getAttribute(k)||(t.setAttribute(k,t.maxLength),t.removeAttribute("maxLength")),t.getAttribute(w)?t.type="text":"password"===t.type&&P.changeType(t,"text")&&t.setAttribute(w,"password"),!0)}function u(t,e){var r,n,a,u,i;if(t&&t.getAttribute(N))e(t);else for(n=t?t.getElementsByTagName("input"):o,a=t?t.getElementsByTagName("textarea"):c,i=0,u=(r=n?n.length:0)+(a?a.length:0);i<u;i++)e(i<r?n[i]:a[i-r])}function i(t){u(t,n)}function l(t){t.form&&("string"==typeof(m=t.form)&&(m=document.getElementById(m)),m.getAttribute(B)||(P.addEventListener(m,"submit",function(t){return function(){i(t)}}(m)),m.setAttribute(B,"true"))),P.addEventListener(t,"focus",function(t){return function(){s&&t.value===t.getAttribute(N)&&"true"===t.getAttribute(S)?P.moveCaret(t,0):n(t)}}(t)),P.addEventListener(t,"blur",function(t){return function(){a(t)}}(t)),s&&(P.addEventListener(t,"keydown",function(e){return function(t){return g=e.value,"true"===e.getAttribute(S)&&g===e.getAttribute(N)&&P.inArray(x,t.keyCode)?(t.preventDefault&&t.preventDefault(),!1):void 0}}(t)),P.addEventListener(t,"keyup",function(t){return function(){n(t,g),""===t.value&&(t.blur(),P.moveCaret(t,0))}}(t)),P.addEventListener(t,"click",function(t){return function(){t===r()&&t.value===t.getAttribute(N)&&"true"===t.getAttribute(S)&&P.moveCaret(t,0)}}(t))),t.setAttribute(C,"true"),t.setAttribute(N,b),(s||t!==r())&&a(t)}var o,c,s,d,g,v,p,b,f,m,h,A,y,E=["text","search","url","tel","email","password","number","textarea"],x=[27,33,34,35,36,37,38,39,40,8,46],L="placeholdersjs",T=RegExp("(?:^|\\s)"+L+"(?!\\S)"),N="data-placeholder-value",S="data-placeholder-active",w="data-placeholder-type",B="data-placeholder-submit",C="data-placeholder-bound",k="data-placeholder-maxlength",I=document.createElement("input"),R=document.getElementsByTagName("head")[0],V=document.documentElement,D=t.Placeholders,P=D.Utils;if(D.nativeSupport=void 0!==I.placeholder,!D.nativeSupport){for(o=document.getElementsByTagName("input"),c=document.getElementsByTagName("textarea"),s="false"===V.getAttribute("data-placeholder-focus"),d="false"!==V.getAttribute("data-placeholder-live"),(v=document.createElement("style")).type="text/css",p=document.createTextNode("."+L+" { color:#ccc; }"),v.styleSheet?v.styleSheet.cssText=p.nodeValue:v.appendChild(p),R.insertBefore(v,R.firstChild),y=0,A=o.length+c.length;y<A;y++)h=o.length>y?o[y]:c[y-o.length],(b=h.attributes.placeholder)&&((b=b.nodeValue)&&P.inArray(E,h.type)&&l(h));f=setInterval(function(){for(y=0,A=o.length+c.length;y<A;y++)h=o.length>y?o[y]:c[y-o.length],(b=h.attributes.placeholder)?(b=b.nodeValue)&&P.inArray(E,h.type)&&(h.getAttribute(C)||l(h),(b!==h.getAttribute(N)||"password"===h.type&&!h.getAttribute(w))&&("password"===h.type&&!h.getAttribute(w)&&P.changeType(h,"text")&&h.setAttribute(w,"password"),h.value===h.getAttribute(N)&&(h.value=b),h.setAttribute(N,b))):h.getAttribute(S)&&(n(h),h.removeAttribute(N));d||clearInterval(f)},100)}P.addEventListener(t,"beforeunload",function(){D.disable()}),D.disable=D.nativeSupport?e:i,D.enable=D.nativeSupport?e:function(t){u(t,a)}}(this);