function UPNewsMain()
{
    global $sourcedir, $context, $txt;
    global $ultimateportalSettings;
    //Inicialized the Ultimate Portal?
    $context['ultimate_portal_initialized'] = true;
    // Load UltimatePortal Settings
    ultimateportalSettings();
    // Load UltimatePortal template
    loadtemplate('UPNews');
    // Load Language
    loadLanguage('UPNews');
    //Is active the NEWS module?
    if (empty($ultimateportalSettings['up_news_enable'])) {
        fatal_lang_error('ultport_error_no_active_news', false);
    }
    //Load subactions for the Ultimate Portal - Module NEWS
    $subActions = array('main' => 'ShowNewsMain', 'show-cat' => 'ShowCat', 'view-new' => 'ViewNew', 'add-new' => 'AddNew', 'edit-new' => 'EditNew', 'delete-new' => 'DeleteNew');
    $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : 'main';
    $subActions[$_REQUEST['sa']]();
}
function UltimatePortalMain()
{
    global $context, $ultimateportalSettings, $txt, $settings, $user_info;
    if (WIRELESS) {
        redirectexit('action=forum');
    }
    // Load UltimatePortal Settings
    ultimateportalSettings();
    // Load Language
    loadLanguage('UltimatePortal');
    if (!empty($context['linktree']) && !empty($ultimateportalSettings['ultimate_portal_enable'])) {
        foreach ($context['linktree'] as $key => $tree) {
            if (strpos($tree['url'], '#') !== false && strpos($tree['url'], 'action=forum#') === false) {
                $context['linktree'][$key]['url'] = str_replace('#', '?action=forum#', $tree['url']);
            }
        }
    }
    //Inicialized the Ultimate Portal?
    $context['ultimate_portal_initialized'] = true;
    //Load Headers UP
    $context['html_headers'] .= '
	<meta name="generator" content="Ultimate Portal - www.smfsimple.com" />
	<script src="http://code.jquery.com/jquery.min.js"></script>
	<script src="' . $settings['default_theme_url'] . '/scripts/sharrre-1.3.4.js"></script>
	<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
		function collapse(id,span)
		{
			var hide = new Array();
			hide[1] = "up_left";
			hide[2] = "up_right";
			mode = document.getElementById(hide[id]).style.display == "" ? 0 : 1;' . ($user_info['is_guest'] ? '
			document.cookie = hide[id] + "=" + (mode ? 0 : 1);' : '
			smf_setThemeOption(hide[id], mode ? 0 : 1, null, "' . $context['session_id'] . '", "' . $context['session_var'] . '");') . '
			document.getElementById(span).innerHTML = (mode ? "' . $txt['ultport_hide'] . '" : "' . $txt['ultport_unhide'] . '"); 						
			document.getElementById(hide[id]).style.display = mode ? "" : "none";
		}
		function collapseBlock(id,img_id)
		{
			var hide = new Array();
			hide[id] = "up_bk_"+ id;
			mode = document.getElementById(hide[id]).style.display == "" ? 0 : 1;' . ($user_info['is_guest'] ? '
			document.cookie = hide[id] + "=" + (mode ? 0 : 1);' : '
			smf_setThemeOption(hide[id], mode ? 0 : 1, null, "' . $context['session_id'] . '", "' . $context['session_var'] . '");') . '
			document.getElementById(img_id).src = (mode ? "' . $settings['default_theme_url'] . '/images/ultimate-portal/collapse.gif" : "' . $settings['default_theme_url'] . '/images/ultimate-portal/expand.gif");
			document.getElementById(hide[id]).style.display = mode ? "" : "none";
		}				
	// ]]></script>' . (!empty($ultimateportalSettings['favicons']) ? '<link rel="shortcut icon" href="' . $settings['default_theme_url'] . '/images/ultimate-portal/favicon.png" />' : '') . '
		<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/UltimatePortalCSS.css" />';
    //End Load headers UP
    //Seo Google Analytics
    if (!empty($ultimateportalSettings['seo_google_analytics'])) {
        $context['insert_after_template'] .= '
			<!-- Ultimate Portal Seo Google Analytics -->
			<script type="text/javascript"><!-- // --><![CDATA[
				var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
				document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
				</script>
				<script type="text/javascript">
				try {
				var pageTracker = _gat._getTracker("' . $ultimateportalSettings['seo_google_analytics'] . '");
				pageTracker._trackPageview();
				} catch(err) {}
			// ]]></script>';
    }
}