function squirrelmail_loginpage_onload() { document.forms[0].js_autodetect_results.value = '1'; var textElements = 0; for (i = 0; i < document.forms[0].elements.length; i++) { if (document.forms[0].elements[i].type == "text" || document.forms[0].elements[i].type == "password") { textElements++; if (textElements == 1) { document.forms[0].elements[i].focus(); break; } } } }