//default formfield for passwords
function setBoxToPasswordmode(box) {
	if (box.value == box.defaultValue) {
		box.type = "password";
		box.value = "";
	}
}

function resetBox(box) {
	if (box.value == "") {
		box.type = "text";
		box.value = box.defaultValue;
	}
}

$(document).ready(function() {
	//test for element existing on page then run code
	if($("#login_password").length > 0){
		$("#login_password").hide(); //hide password input
		var old_id = $("#login_password").attr("id"); //store id of password input
		$("#login_password").attr("id","hidden_password"); //change id of hidden input
		
		var password_hint = document.createElement("input");
		
		$(password_hint).attr("id", old_id); //assign id of hidden input
		$(password_hint).attr("type", "text"); //set text type
		$(password_hint).attr("tabindex", "4"); //set tab index
		$(password_hint).addClass("textInput"); //set class for input
		$(password_hint).val("Password"); //set hint value
		$("#hidden_password").after(password_hint); //add hint input after hidden input
		
		$(password_hint).focus(function(){
			$("#hidden_password").show()
			$("#login_password").hide()
			$("#hidden_password").focus()
		});
		
		$("#hidden_password").blur(function(){
			if($("#hidden_password").val() == ""){
				$("#hidden_password").hide()
				$("#login_password").show()
			}
		});
	}
});
