Within the CGIPROXY code, there's a function called proxify_html(). It's... quite involved.
js_insertion() gets called at the start of every document to insert the URL-bar header. Use that if you want to insert something else into the top of every document.