function Dpassword( element ) {
     if (!arguments.length) {
         return;
     }
     var t = this;
     t.constructor = arguments.callee;
     
     t._passwordElement = element;
     t._name = t._passwordElement.name;
     t._id = t._passwordElement.id;
     t._cssclass = t._passwordElement.className;
     t._style = t._passwordElement.getAttribute("style");
     t._size = t._passwordElement.size;
     t._maxlength = t._passwordElement.getAttribute("maxlength");       
     t._disabled = t._passwordElement.disabled;
     t._tabindex = t._passwordElement.getAttribute("tabindex");       
     t._accesskey = t._passwordElement.getAttribute("accesskey");       
     t._value = t._passwordElement.value;
     
     t.prefix = "password_";
     t._interval = 200;
     t._clearTimeout = null;
     t._clearLastCharTimeout = null;
     t._oldValue = "";
     t._replacement = "%u25CF";
     t._duration = 2000;
 };
 
 Dpassword.prototype = {
   
      init : function(){
         var t = this;

          t._passwordElement.style.display = "none";

          var newPasswordElement = document.createElement("input");

          newPasswordElement.type = "text";
          newPasswordElement.id = t.prefix+t._id;
          newPasswordElement.name = t.prefix+t._name;
          ( t._cssclass != "" ) && ( newPasswordElement.className = t._cssclass );
          ( t._style != "" ) && ( newPasswordElement.setAttribute("style",t._style) );
          ( t._size != "" ) && ( newPasswordElement.setAttribute("size", t._size) );
          ( t._maxlength && t._maxlength != -1 ) && ( newPasswordElement.setAttribute("maxlength", t._maxlength) );
          ( t._disabled != "" ) && ( newPasswordElement.disabled = t._disabled );
          ( t._tabindex && t._tabindex != "" ) && ( newPasswordElement.setAttribute("tabindex", t._tabindex) );
          ( t._accesskey != undefined ) && ( newPasswordElement.setAttribute("accesskey", t._accesskey) );
          newPasswordElement.setAttribute("autocomplete", "off");
          
          var nextSiblingNode = t._passwordElement.nextSibling;
          
          if( nextSiblingNode ) {
              t._passwordElement.parentNode.insertBefore(newPasswordElement,nextSiblingNode);
          } else {
              t._passwordElement.parentNode.appendChild(newPasswordElement);
          }
          
          t._newPasswordElement = document.getElementById(t.prefix+t._id);            
          t._newPasswordElement.onfocus = function(){
               t.focusEvent.call(t);
          }
          t._newPasswordElement.onblur = function(){
               t.blurEvent.call(t);
          }
          
          t.check.call(t,true);
      },
      check : function( flag ){
          var t = this;
          
          if (t._oldValue != t._newPasswordElement.value) {
              t.setPassword( t._newPasswordElement.value );
              if (t._newPasswordElement.value.length > 1) {
                  var tmp = '';
                  for (var i = 0, len = t._newPasswordElement.value.length - 1; i < len; i++) {
                      tmp += unescape(t._replacement);
                  }
                  tmp = tmp + t._newPasswordElement.value.charAt(t._newPasswordElement.value.length - 1);
                                      
                  var position = 0;
                  if( document.selection ){
                     var workRange = document.selection.createRange();
                     t._newPasswordElement.select();
                     workRange.setEndPoint("StartToStart",document.selection.createRange());
                     position = workRange.text.replace(/\r?\n/g, ' ').length;
                  } else {
                     position = t._newPasswordElement.selectionStart;
                  }

                  t._newPasswordElement.value = tmp;
                  
                  if( document.selection ){
                     var range = t._newPasswordElement.createTextRange();
                     range.move('character', position);
                     range.select();
                  } else {
                     t._newPasswordElement.setSelectionRange(position, position);
                  }
              }
              t._clearLastCharTimeout && clearTimeout(t._clearLastCharTimeout);
              
              t._clearLastCharTimeout = setTimeout(function(){
                  t.convertLastChar();
              }, t._duration);
          }
          if( !flag ) {
              t._oldValue = t._newPasswordElement.value;
              t._clearTimeout = setTimeout(function(){
                 t.check();
              },t._interval);
          }
      },
      setPassword : function( str ){
          var t = this;
          
          var tmp = "";
          for (var i = 0, len = str.length; i < len; i++) {
              if (str.charAt(i) == unescape(t._replacement)) {
                  tmp = tmp + t._passwordElement.value.charAt(i);
              } else {
                  tmp = tmp + str.charAt(i);
              }
          }
          t._passwordElement.value = tmp;
        
      },
      convertLastChar : function(){
          var t = this;
          
          if (t._newPasswordElement.value != "") {
             var tmp = '';
             for (var i = 0; i < t._newPasswordElement.value.length; i++) {
                 tmp = tmp + unescape(t._replacement);
             }
             t._newPasswordElement.value = tmp;
          }
      },
      focusEvent : function() {
         var t = this;
         
         t._clearTimeout = window.setTimeout(function(){
             t.check(false);
         },t._interval);
      
      },
      blurEvent : function() {
         var t = this;
          
         t._clearTimeout && clearInterval(t._clearTimeout);
      } 
};