I'm guessing here because I don't want to go through all your code but I imagine you are replacing a
<input type="text" /> with
<input type="password" /> when the user has focus on the
input. I don't think that is the best cross browser solution.
placeholder value won't work on all browsers.
A good solution is using the
<label> tag positioned under the
input instead of faking it. For a good example see: http://blog.stannard.net.au/2011/01/07/creating-a-form-with-labels-inside-text-fields-using-jquery/
The advantages of this solution includes cross browser compatibility, accessibility and semantic markup.