nextfield = "username__"; // name of first box on page
netscape = "";
ver = navigator.appVersion; len = ver.length;
for(iln = 0; iln < len; iln++) if (ver.charAt(iln) == "(") break;
netscape = (ver.charAt(iln+1).toUpperCase() != "C");

function keyDown(DnEvents) { // handles keypress
	// determines whether Netscape or Internet Explorer
	k = (netscape) ? DnEvents.which : window.event.keyCode;
	if (k == 13) { // enter key pressed
		if (nextfield == 'btnOK') {
			return validate_form(document.theForm);
		}
		else { // we're not done yet, send focus to next box
			eval('document.theForm.' + nextfield + '.focus()');
			return false;
    	}
	}
}
document.onkeydown = keyDown; // work together to analyze keystrokes
if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);

function validate_form(theForm) {
	// Login_Username
	if (theForm.username__.value == "") {
		alert("Please enter a valid username.");
		theForm.username__.focus();
		return false;
	}

	// Login_Password
	if (theForm.password__.value == "") {
		alert("Please enter a valid password.");
		theForm.password__.focus();
		return false;
	}
	
	// All Javascript checks pass
	return true;
}

function newWindow( pageToLoad, winName, width, height, center) {                                    
    xposition=0; yposition=0;
    args = "WIDTH=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=0,"
    + "scrollbars=0,"
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    window.open( pageToLoad,winName,args );
}
