function reg()
{
	document.getElementById('login').style.display = 'none';
	document.getElementById('reg').style.display = 'block';	
	document.getElementById('b').focus();
}

function chkl()
{
	if (document.lf.lu.value == '') { alert('Please enter your address!'); return; }
	if (document.lf.lup.value == '') { alert('Please enter your password!'); return; }	
	window.frames.xxmrpc.location.href = '/rpc?login='+escape(document.lf.lu.value)+'&p='+escape(document.lf.lup.value);
}

function cre()
{
	var r = document.lf.raddr.value;

	if (r == '') { alert('Please enter your desired address!'); return; }
	if (document.lf.pass1.value == '') { alert('Please provide your password of choice!'); return; }
	if (document.lf.pass2.value == '') { alert('Please repeat your password in the second field'); return; }	
	if (document.lf.pass2.value != document.lf.pass1.value) { alert('The passwords do not match, please type the same password in both fields!'); return; }
	
	if ((r.length + document.lf.pass1.value.length) > 100) {
		alert('Your address is too long. Please use a shorter address!'); return;
	}
	
	if (r.substr(0, 12).toLowerCase() == 'xx-mail.com/') {
		r = r.substr(12);
		document.lf.raddr.value = r;
	}

	window.frames.xxmrpc.location.href = '/rpc?chkfree='+escape(r);
}

function chkfree_inuse()
{
	alert('Sorry, this address is already in use! Please choose another.');
	document.lf.raddr.focus();
}

function chkfree_ok()
{
	document.lf.ok.value = '31337';
	document.lf.submit();
}

function login_nf()
{
	alert('Sorry, this address is unknown. Please be sure to correct any spelling mistakes in your address and try again!');
	document.lf.addr.focus();
}

function login_wp()
{
	alert('Wrong password! Please try again.');
	document.lf.pass.focus();
}

function login_ok(srv)
{
	document.lf.action = 'http://xxm'+srv+'.xx-mail.com/xxm-en';
	document.lf.ok.value = '31337';
	document.lf.submit();
}
