function setFocus()
{
    if (document.mail_login.imapuser.value == "") {
        document.mail_login.imapuser.focus();
    } else {
        document.mail_login.pass.focus();
    }
}

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;
    }
}

