+/**
+ * Blatantly copied/truncated/modified from displayPageHeader.
+ * Outputs a page header specifically for the compose_in_new popup window
+ *
+ * @param array color the array of theme colors
+ * @param string mailbox the current mailbox name to display
+ * @param string sHeaderJs javascipt code to be inserted in a script block in the header
+ * @param string sOnload JavaScript code to be added inside the body's onload handler
+ * as of 1.5.2, this replaces $sBodyTagJs argument
+ * @return void
+ */
+function compose_Header($color, $mailbox, $sHeaderJs='', $sOnload = '') {
+
+ global $reply_focus, $action, $oTemplate;
+
+ if (empty($sOnload)) {
+ if (strpos($action, 'reply') !== FALSE && $reply_focus) {
+ if ($reply_focus == 'select')
+ $sOnload = 'checkForm(\'select\');';
+ else if ($reply_focus == 'focus')
+ $sOnload = 'checkForm(\'focus\');';
+ else if ($reply_focus != 'none')
+ $sOnload = 'checkForm();';
+ }
+ else
+ $sOnload = 'checkForm();';
+ }
+
+
+ /*
+ * Locate the first displayable form element (only when JavaScript on)
+ */
+ if(checkForJavascript()) {
+ if ($sHeaderJs) {
+ $sJsBlock = "\n<script type=\"text/javascript\">" .
+ "\n<!--\n" .
+ $sHeaderJs . "\n\n// -->\n</script>\n";
+ } else {
+ $sJsBlock = '';
+ }
+ $sJsBlock .= "\n";
+
+ $js_includes = $oTemplate->get_javascript_includes(TRUE);
+ foreach ($js_includes as $js_file) {
+ $sJsBlock .= '<script src="'.$js_file.'" type="text/javascript"></script>' ."\n";
+ }
+
+ displayHtmlHeader (_("Compose"), $sJsBlock);
+ } else {
+ /* javascript off */
+ displayHtmlHeader(_("Compose"));
+ $sOnload = '';
+ }
+
+// FIXME: change the colorization attributes below to a CSS class!
+ $class = '';
+ $aAttribs = array('text' => $color[8], 'bgcolor' => $color[4],
+ 'link' => $color[7], 'vlink' => $color[7],
+ 'alink' => $color[7]);
+
+ // this is template-safe (see create_body() function)
+ echo create_body($sOnload, $class, $aAttribs);
+
+ global $null;
+ do_hook('compose_header_bottom', $null);
+}