I don't why I can program and work with databases all day long, but when it comes to even the simplest javascript I still have problems

I was just trying to a simple things with forms so that when one box has the right number of characters it jumps to the next box.

Code:
<script>
function changeInputFocus(thisInput, nextInput, maxChars)	{
		var inputVal = getElementByID(thisInput);
		if(inputVal.value.length >= maxChars)	{
			// Application is the name of the form
			document.Application.nextInput.focus();
		}
	}
</script>

--- within form ---
<input name="phone1" type="text" size="3" maxlength="3" value="" onkeypress="javascript: changeInputFocus('phone1', 'phone2', 3)">-
<input name="phone2" type="text" size="3" maxlength="3" value="">-