function hookOutputPageBeforeHTML(OutputPage &$out, &$text)
{
    if ($out->getTitle()->getNamespace() == 6) {
        //6 is the File Namespace
        $out->includeJQuery();
        $out->addModules('ext.SemanticImageAnnotator');
    }
    return true;
}
/**
 * Adds required JavaScript & CSS files to the HTML output of a page if AjaxLogin is enabled
 *
 * @param $out OutputPage object
 * @return true
 */
function AjaxLoginJS(OutputPage $out)
{
    global $wgEnableAjaxLogin, $wgScriptPath;
    # Don't load anything if AjaxLogin isn't enabled or if we're on login page
    if (!isset($wgEnableAjaxLogin) || $out->getTitle()->isSpecial('Userlogin')) {
        return true;
    }
    // Our custom CSS
    $out->addExtensionStyle($wgScriptPath . '/extensions/AjaxLogin/AjaxLogin.css');
    // jQuery and JQModal scripts
    $out->includeJQuery();
    $out->addScriptFile($wgScriptPath . '/extensions/AjaxLogin/jqModal.js');
    $out->addScriptFile($wgScriptPath . '/extensions/AjaxLogin/AjaxLogin.js');
    return true;
}