public function head()
    {
        global $event, $theme;

        if ($event != 'rah_terminal') {
            return;
        }

        $error = escape_js($theme->announce_async(array(gTxt('rah_terminal_fatal_error'), E_ERROR)));

        echo <<<EOF
            <style type="text/css">
                .rah_terminal_result_close {
                    float: right;
                }
                .rah_terminal_result pre {
                    max-height: 9em;
                    overflow-y: auto;
                }
            </style>
EOF;

        $js = <<<EOF
            $(document).ready(function(){
                $('form#rah_terminal_container').txpAsyncForm({
                    error : function() {
                        $.globalEval('{$error}');
                    },
                    success : function(form, event, data) {
                        if($.trim(data) === '') {
                            $.globalEval('{$error}');
                        }
                    }
                });

                $(document).on('click', '.rah_terminal_result_close', function(e) {
                    e.preventDefault();
                    $(this).parents('.rah_terminal_result').remove();
                });
            });
EOF;

        echo script_js($js);
    }