<style type="text/css">
.notice { display: none; }
</style>

<form method="POST" id="newpass-form">
<p>{"New password"}:<br /><input type="password" name="password" size="20" value="{{ password }}" />
<span class="notice" id="password-notice">{"Your password must be at least 6 characters."}</span></p>
<p>{"Verify new password"}:<br /><input type="password" name="verify_pass" size="20" value="{{ verify_pass }}" />
<span class="notice" id="verify_pass-notice">{"Your password doesn't match."}</span></p>
<p><input type="submit" value="{"Reset Password"}" /></p>
</form>

<script type="text/javascript" src="/js/jquery.verify_values.js"></script>
<script type="text/javascript">
$(function () {
	$('#newpass-form').verify_values ({
		handler: 'user/newpass',
		callback: function (failed) {
			// highlight the failed elements
			for (var i = 0; i < failed.length; i++) {
				$('#' + failed[i] + '-notice').show ();
			}
		},
		reset: function (fields) {
			for (var i = 0; i < fields.length; i++) {
				$('#' + fields[i] + '-notice').hide ();
			}
		}
	});
	{% foreach failed %}
	$('#{{ loop_value }}-notice').show ();
	{% end %}
});
</script>
