function setFocus()
{
    document.implogin.imapuser.focus();
}

function submit_login()
{
    if (document.implogin.imapuser.value == "") {
        alert('请提供你的用户名和密码');
        document.implogin.imapuser.focus();
        return false;
    } else if (document.implogin.pass.value == "") {
        alert('请提供你的用户名和密码');
        document.implogin.pass.focus();
        return false;
    } else {
	if(!document.implogin.imapuser.value.match(/@/)){
		document.implogin.imapuser.value=document.implogin.imapuser.value +"@zj-highway.com";
	}
        return true;
    }
}

function enter_key_trap(e)
{
    var keyPressed;

    if (document.layers) {
        keyPressed = String.fromCharCode(e.which);
    } else if (document.all) {
        keyPressed = String.fromCharCode(window.event.keyCode);
    } else if (document.getElementById) {
        keyPressed = String.fromCharCode(e.keyCode);
    }

    if ((keyPressed == "\r" || keyPressed == "\n") && (submit_login())) {
        document.implogin.submit();
    }
}

if (window.document.captureEvents != null) {
    window.document.captureEvents(Event.KEYPRESS);
    window.document.onkeypress = enter_key_trap;
}