function setFocus()
{
    if (document.mail_login.imapuser.value == "") {
        document.mail_login.imapuser.focus();
    } else {
        document.mail_login.pass.focus();
    }
}
<!-- CLSH: 2528 -->

function checkmail(xx)
{

	rex=true;
	if (window.RegExp)
	{
		st="a";ex=new RegExp(st);
		if (st.match(ex))
		{
			r1=new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
			r2=new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
			b=(!r1.test(xx)&&r2.test(xx));
		}
		else
		{
			rex=false;
		}
	}
	else
	{
		rex=false;
	}
	
	if(!rex)
		b=(xx.indexOf("@")>0&&xx.indexOf(".")>0&&xx!=""&&xx!="e-mail");
	return (b);
}

function submit_login(e)
{
    if (typeof e != 'undefined' && !enter_key_trap(e)) {
        return;
    }

//    if (!checkmail(document.mail_login.imapuser.value) || document.mail_login.imapuser.value == "" ) 
    if (document.mail_login.imapuser.value == "" )
    {
        alert('Please provide your username.');
        document.mail_login.imapuser.focus();
        return false;
    } else if (document.mail_login.pass.value == "") {
        alert('Please provide your password.');
        document.mail_login.pass.focus();
        return false;
    } else {
//        document.mail_login.loginButton.disabled = true;
//        document.mail_login.ie_version.value = objCCaps.getComponentVersion("{89820200-ECBD-11CF-8B85-00AA005B4383}","componentid");
        document.mail_login.submit();
        return true;
    }
}

function updatePort()
{
}

function selectLang()
{
    // We need to reload the login page here, but only if the user hasn't
    // already entered a username and password.
    if (document.mail_login.imapuser.value == '' &&
        document.mail_login.pass.value == '') {
        var lang_page = 'login.php?new_lang=' + document.mail_login.new_lang[document.mail_login.new_lang.selectedIndex].value;
        self.location = lang_page;
    }
}
if (parent.frames.webmail_main) {
    document.mail_login.target = '_parent';
}
