diff -r -u vanilla.4/typo3/sysext/cms/tslib/class.tslib_fe.php typo3_src-4.0.4/typo3/sysext/cms/tslib/class.tslib_fe.php --- vanilla.4/typo3/sysext/cms/tslib/class.tslib_fe.php 2006-12-26 21:12:43.000000000 +0100 +++ typo3_src-4.0.4/typo3/sysext/cms/tslib/class.tslib_fe.php 2006-12-26 21:18:09.000000000 +0100 @@ -286,6 +286,7 @@ 'onmousemove' => array(), 'onmouseup' => array(), 'onload' => array(), + 'onunload' => array(), ); var $JSCode=''; // Deprecated, use additionalJavaScript instead. var $JSImgCode=''; // Used to accumulate JavaScript loaded images (by menus) diff -r -u vanilla.4/typo3/sysext/cms/tslib/class.tslib_pagegen.php typo3_src-4.0.4/typo3/sysext/cms/tslib/class.tslib_pagegen.php --- vanilla.4/typo3/sysext/cms/tslib/class.tslib_pagegen.php 2006-12-26 21:12:43.000000000 +0100 +++ typo3_src-4.0.4/typo3/sysext/cms/tslib/class.tslib_pagegen.php 2006-12-26 21:19:12.000000000 +0100 @@ -337,7 +337,12 @@ $setEvents[]=' document.onload=T3_onloadWrapper;'; $setBody[]='onload="T3_onloadWrapper();"'; } - + if (is_array($GLOBALS['TSFE']->JSeventFuncCalls['onunload']) && count($GLOBALS['TSFE']->JSeventFuncCalls['onunload'])) { + $functions[]=' function T3_onunloadWrapper() { '.implode(' ',$GLOBALS['TSFE']->JSeventFuncCalls['onunload']).' }'; + $setEvents[]=' document.onunload=T3_onloadWrapper;'; + $setBody[]='onunload="T3_onunloadWrapper();"'; + } + return Array(count($functions)?'