code: function drawChatIn() {
      $(CHATIN).show();
      function submit() {
          var chatin = $(CHATIN+"> input")[0].value;
          if (!CHATRE.test(chatin)) {
              if(chatin) {
                  alert("Your input text is too long!");
              }
              return false;
          }
          var game = $.cookie("game");
          var resource;
          if (game) {
              resource = "/games/" + enc(game) + "/chat";
          } else {
              resource = "/chat";
          }
          $.post(resource, {
              input: chatin,
              name: $.cookie("player")
          }, function() {
              $(CHATIN+"> input").val('');  // post was succesful, so clear input
              drawChatLog();
          });
      }
      $(CHATIN+"> button").click(submit);
      $(CHATIN+"> input:visible").focus();
      $(CHATIN+"> input").keydown(function(event) {
          if (event.keyCode === 13) {
              submit();
          }
      });
  }
docs: Draw the chat input.