(function(n){typeof define=="function"&&define.amd?define(["jquery"],n):n(jQuery)})(function(n){function l(t){var i={},r=/^jQuery\d+$/;return n.each(t.attributes,function(n,t){t.specified&&!r.test(t.name)&&(i[t.name]=t.value)}),i}function u(t,i){var u=this,r=n(u);if(u.value==r.attr("placeholder")&&r.hasClass("placeholder"))if(r.data("placeholder-password")){if(r=r.hide().nextAll('input[type="password"]:first').show().attr("id",r.removeAttr("id").data("placeholder-id")),t===!0)return r[0].value=i;r.focus()}else u.value="",r.removeClass("placeholder"),u==c()&&u.select()}function e(){var i,r=this,t=n(r),f=this.id;if(r.value===""){if(r.type==="password"){if(!t.data("placeholder-textinput")){try{i=t.clone().attr({type:"text"})}catch(e){i=n("<input>").attr(n.extend(l(this),{type:"text"}))}i.removeAttr("name").data({"placeholder-password":t,"placeholder-id":f}).bind("focus.placeholder",u);t.data({"placeholder-textinput":i,"placeholder-id":f}).before(i)}t=t.removeAttr("id").hide().prevAll('input[type="text"]:first').attr("id",f).show()}t.addClass("placeholder");t[0].value=t.attr("placeholder")}else t.removeClass("placeholder")}function c(){try{return document.activeElement}catch(n){}}var o=Object.prototype.toString.call(window.operamini)=="[object OperaMini]",r="placeholder"in document.createElement("input")&&!o,f="placeholder"in document.createElement("textarea")&&!o,s=n.valHooks,h=n.propHooks,i,t;r&&f?(t=n.fn.placeholder=function(){return this},t.input=t.textarea=!0):(t=n.fn.placeholder=function(){var n=this;return n.filter((r?"textarea":":input")+"[placeholder]").not(".placeholder").bind({"focus.placeholder":u,"blur.placeholder":e}).data("placeholder-enabled",!0).trigger("blur.placeholder"),n},t.input=r,t.textarea=f,i={get:function(t){var i=n(t),r=i.data("placeholder-password");return r?r[0].value:i.data("placeholder-enabled")&&i.hasClass("placeholder")?"":t.value},set:function(t,i){var r=n(t),f=r.data("placeholder-password");return f?f[0].value=i:r.data("placeholder-enabled")?(i===""?(t.value=i,t!=c()&&e.call(t)):r.hasClass("placeholder")?u.call(t,!0,i)||(t.value=i):t.value=i,r):t.value=i}},r||(s.input=i,h.value=i),f||(s.textarea=i,h.value=i),n(function(){n(document).delegate("form","submit.placeholder",function(){var t=n(".placeholder",this).each(u);setTimeout(function(){t.each(e)},10)})}),n(window).bind("beforeunload.placeholder",function(){n(".placeholder").each(function(){this.value=""})}))})