(function(b){function a(d){this.input=d;if(d.attr("type")=="password"){this.handlePassword()}b(d[0].form).submit(function(){if(d.hasClass("placeholder")&&d[0].value==d.attr("placeholder")){d[0].value=""}})}a.prototype={show:function(f){if(this.input[0].value===""||(f&&this.valueIsPlaceholder())){if(this.isPassword){try{this.input[0].setAttribute("type","text")}catch(d){this.input.before(this.fakePassword.show()).hide()}}this.input.addClass("placeholder");this.input[0].value=this.input.attr("placeholder")}},hide:function(){if(this.valueIsPlaceholder()&&this.input.hasClass("placeholder")){this.input.removeClass("placeholder");this.input[0].value="";if(this.isPassword){try{this.input[0].setAttribute("type","password")}catch(d){}this.input.show();this.input[0].focus()}}},valueIsPlaceholder:function(){return this.input[0].value==this.input.attr("placeholder")},handlePassword:function(){var d=this.input;d.attr("realType","password");this.isPassword=true;if(b.browser.msie&&d[0].outerHTML){var e=b(d[0].outerHTML.replace(/type=(['"])?password\1/gi,"type=$1text$1"));this.fakePassword=e.val(d.attr("placeholder")).addClass("placeholder").focus(function(){d.trigger("focus");b(this).hide()});b(d[0].form).submit(function(){e.remove();d.show()})}}};var c=!!("placeholder" in document.createElement("input"));b.fn.placeholder=function(){return c?this:this.each(function(){var d=b(this);var e=new a(d);e.show(true);d.focus(function(){e.hide()});d.blur(function(){e.show(false)});if(b.browser.msie){b(window).load(function(){if(d.val()){d.removeClass("placeholder")}e.show(true)});d.focus(function(){if(this.value==""){var f=this.createTextRange();f.collapse(true);f.moveStart("character",0);f.select()}})}})}})(jQuery);