You can easily insert any data into the page header (between the <head>-Tags) or right before the closing </body>-Tag, by using the following two arrays:
$GLOBALS['TSFE']->additionalHeaderData
$GLOBALS['TSFE']->additionalFooterData
For example:
$GLOBALS['TSFE']->additionalFooterData['funkyJavascript'] = '<script type="text/javascript">alert("shows when page is ready.");</script>';
Note that additionalFooterData works only in USER-Plugins, not in USER_INT … additionalHeaderData however also works with USER_INT plugins.