(function($) {
    $.fn.PasswordInput = function(InputSettings) {
        var Settings = $.extend({ defaultValue: 'L&ouml;senord' }, InputSettings || {});
		var preValue = Settings.defaultValue;
		iCount = 1;
		$(this).each(function(){
			var fieldID = $(this).attr("id");
			if(fieldID.length == 0) { fieldID = "tmpPwInput" + iCount; }
			var fieldName = "";
			if($(this).attr("name").length > 0) { fieldName = " name=\"" + $(this).attr("name") + "\"" }
			var cssClass = "";
			var cssStyle = "";
			if($(this).attr("class").length > 0) { cssClass = " class=\"" + $(this).attr("class") + "\""; }
			if($(this).attr("style") != "undefined") { cssStyle = " style=\"" + $(this).attr("style") + "\""; }
			$(this).after("<input" + cssClass + cssStyle + fieldName + " id=\"" + fieldID + "\" type=\"text\" value=\"" + preValue + "\" />");
			$(this).remove();		
			$("#"+fieldID).focus(function(){
				$(this).after("<input" + cssClass + cssStyle + fieldName + " id=\"" + fieldID + "\" type=\"password\" value=\"\" />");
				$(this).remove();	
				$("#"+fieldID).focus();
				$("#"+fieldID).blur(function(){
					if($(this).val() == preValue || $(this).val() == ""){
						$(this).after("<input" + cssClass + cssStyle + fieldName + " id=\"" + fieldID + "\" type=\"text\" value=\"" + preValue + "\" />");
						$(this).remove();
						$("#"+fieldID).PasswordInput(InputSettings);
					}
				});
			});
			iCount ++;
		});
	}
})(jQuery);
