Função não está sendo chamada

Alguem pode me dizer o porque da funcao que troca o tab pelo enter nao esta sendo chamada ?

Obrigado !

<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:treap="http://java.sun.com/jsf/composite/treap"
      xmlns:p="http://primefaces.org/ui" 
      xmlns:cc="http://java.sun.com/jsf/composite">
    <head>
        <script language="javascript" type="text/javascript">

            var textboxes = $("input, select, textarea");

            if ($.browser.mozilla) {
                $(textboxes).keypress (checkForEnter);
            } else {
                $(textboxes).keydown (checkForEnter);
            }

            function checkForEnter (event) {

                if (event.keyCode == 13) {
                    currentBoxNumber = textboxes.index(this);

                    if (textboxes[currentBoxNumber + 1] != null) {
                        nextBox = textboxes[currentBoxNumber + 1]
                        nextBox.focus();
                        event.preventDefault();
                        return false;
                    } 
                }
            }

        </script>
    </head>
    <body>

        <h:form id="idForm" onkeypress="checkForEnter(event)"> // estou chamado aqui, nao sei se está certo ;s
            <ui:composition template="./default_layout_with_menu.xhtml">
                <ui:define name="titulo-pagina">
// continua