// - Instantiate debug and warning collectors
// - Instantiate an error manager
// - Define global variables relative to the current context (SelfUrl
$Context = new Context();
// DEFINE THE LANGUAGE DICTIONARY
include agAPPLICATION_PATH . "appg/language.php";
// INSTANTIATE THE PAGE OBJECT
// The page object handles collecting all page controls
// and writing them when it's events are fired.
$Page = new Page($Context);
// FIRE INITIALIZATION EVENT
$Page->FireEvent("Page_Init");
// DEFINE THE MASTER PAGE CONTROLS
$Head = $Context->ObjectFactory->NewContextObject($Context, "Head");
$Body = $Context->ObjectFactory->NewContextObject($Context, "ExternalBody");
$Foot = $Context->ObjectFactory->NewContextObject($Context, "ExternalFoot");
$PageEnd = $Context->ObjectFactory->NewContextObject($Context, "PageEnd");
// INCLUDE EXTENSIONS
include agAPPLICATION_PATH . "appg/extensions.php";
// BUILD THE PAGE HEAD
// Every page will require some basic definitions for the header.
$Head->AddScript("./js/global.js");
$Head->AddScript("./js/vanilla.js");
$Head->AddScript("/egroupware/jscripts/tiny_mce/tiny_mce.js");
$Head->AddStyleSheet($Context->StyleUrl . "signin.css", "screen");
$Head->AddStyleSheet($Context->StyleUrl . "signin.handheld.css", "handheld");
// Add the end of the page
$Page->AddControl("Head_Render", $Head);
$Page->AddControl("Page_Unload", $PageEnd);
// Include the control file for this page
$Page->Import($Page->ControlFile);
				entity_encoding: "raw",
				cleanup : false,
				content_css : "/egroupware/jscripts/tiny_mce/themes/advanced/vanilla.css",
				theme_advanced_buttons1_add : "forecolor,backcolor",
// 				add_form_submit_trigger : false,
// 				submit_patch : false,
                                force_br_newlines : true,
				theme_advanced_buttons3_add_before : "tablecontrols,separator",
				theme_advanced_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1",
				debug : false
			});
		</script>');
// BUILD THE MAIN MENU
$Menu->AddTab($Context->GetDefinition("Discussions"), "discussions", "./", "DiscussionsTab");
if (agUSE_CATEGORIES) {
    $Menu->AddTab($Context->GetDefinition("Categories"), "categories", "categories.php", "CategoriesTab");
}
$Menu->AddTab($Context->GetDefinition("Search"), "search", "search.php", "SearchTab");
if ($Context->Session->UserID > 0) {
    if ($Context->Session->User->AdminCategories || $Context->Session->User->AdminUsers || $Context->Session->User->MasterAdmin) {
        $Menu->AddTab($Context->GetDefinition("Settings"), "settings", "settings.php", "SettingsTab");
    }
    $Menu->AddTab($Context->GetDefinition("Account"), "account", "account.php", "AccountTab");
}
// INCLUDE EXTENSIONS
include agAPPLICATION_PATH . "appg/extensions.php";
// Add the end of the page
$Page->AddControl("Foot_Render", $Foot);
$Page->AddControl("Page_Unload", $PageEnd);
// Include the control file for this page
$Page->Import($Page->ControlFile);