/**
 * Create a header for a popup.
 * param $theme - The name of the current theme
 */
function insert_popup_header($theme)
{
    global $app_strings, $sugar_config, $sugar_version;
    $charset = $sugar_config['default_charset'];
    if (isset($app_strings['LBL_CHARSET'])) {
        $charset = $app_strings['LBL_CHARSET'];
    }
    $colorTheme = get_style_color($theme);
    $out = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
    $out .= '<HTML><HEAD>';
    $out .= '<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '">';
    $out .= '<title>' . $app_strings['LBL_BROWSER_TITLE'] . '</title>';
    $out .= '<style type="text/css">@import url("themes/' . $theme . '/style.css?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '"); </style>';
    $out .= '<link href="themes/' . $theme . '/colors.' . $colorTheme . '.css?s=' . $sugar_version . '&c=' . $sugar_config['js_custom_version'] . '" rel="stylesheet" type="text/css" title="' . $colorTheme . '" />';
    $out .= '</HEAD><BODY style="margin: 10px">';
    echo $out;
}
 $send_version = isset($_REQUEST['version']) ? $_REQUEST['version'] : "";
 $send_edition = isset($_REQUEST['edition']) ? $_REQUEST['edition'] : "";
 $send_lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : "";
 $send_module = isset($_REQUEST['help_module']) ? $_REQUEST['help_module'] : "";
 $send_action = isset($_REQUEST['help_action']) ? $_REQUEST['help_action'] : "";
 $send_key = isset($_REQUEST['key']) ? $_REQUEST['key'] : "";
 // awu: Fixes the ProjectTasks pluralization issue -- must fix in later versions.
 if ($send_module == 'ProjectTasks') {
     $send_module = 'ProjectTask';
 }
 $helpPath = 'modules/' . $send_module . '/language/' . $send_lang . '.help.' . $send_action . '.html';
 $sugar_smarty = new Sugar_Smarty();
 $styleSheet = "themes/" . $theme . "/style.css";
 require_once 'themes/' . $theme . '/layout_utils.php';
 if (function_exists('get_style_color')) {
     $colorTheme = get_style_color($theme);
     $sugar_smarty->assign('styleColor', 'themes/' . $theme . '/colors.' . $colorTheme . '.css');
 }
 if (file_exists($helpPath)) {
     $sugar_smarty->assign('helpFileExists', TRUE);
     $sugar_smarty->assign('helpPath', $helpPath);
     $sugar_smarty->assign('helpBar', getHelpBar($send_module));
     $sugar_smarty->assign('bookmarkScript', bookmarkJS());
 } else {
     $sugar_smarty->assign('helpFileExists', FALSE);
     $iframe_url = add_http("www.sugarcrm.com/network/help.php?version={$send_version}&edition={$send_edition}&lang={$send_lang}&module={$send_module}&action={$send_action}&key={$send_key}");
     $sugar_smarty->assign('iframeURL', $iframe_url);
 }
 $sugar_smarty->assign('title', $mod_strings['LBL_SUGARCRM_HELP'] . " - " . $send_module);
 $sugar_smarty->assign('styleSheet', $styleSheet);
 $sugar_smarty->assign('table', getTable());