function initfocus(url)
{
	if (window.opener) {
		window.opener.location.href = url;
		window.close();
		return;
	}
	var elem = document.getElementById("user");
	if (!elem || elem.value.length == 6) {
		elem = document.getElementById("pw");
		if (!elem)
			elem = document.getElementById("pw1");
	}
	if (elem)
		elem.focus();
}

function
spaces(len)
{
	var s = '';
	for (var i = 0; i < len; i++)
		s += ' ';
	return s;
}

function hash(f)
{
	var hash = sha1Hash;	// sha256
	f.nonce.value = hash(f.nonce.value + hash(f.pw.value));
	f.pw.value = spaces(f.pw.value.length);
	return true;
}

function hash2(f)
{
	if (f.pw1 && f.pw2 && f.pw1.value != f.pw2.value) {
		alert("Passwords must be identical.");
		return false;
	}

	var hash = sha1Hash;	// sha256
	f.nonce.value = hash(f.pw1.value);
	f.pw1.value = f.pw2.value = spaces(f.pw.value.length);
	return true;
}

