function mvSetupExtension()
{
    global $mvgIP, $wgHooks, $wgExtensionCredits, $wgParser, $wgAjaxExportList, $wgAutoloadClasses, $wgSpecialPages, $wgMediaHandlers;
    //add the ALL page header
    mvfAutoAllPageHeader();
    /********************************
     * Ajax Hooks
     *********************************/
    $wgAjaxExportList[] = 'mv_auto_complete_all';
    $wgAjaxExportList[] = 'mv_auto_complete_person';
    $wgAjaxExportList[] = 'mv_auto_complete_stream_name';
    $wgAjaxExportList[] = 'mv_helpers_auto_complete';
    $wgAjaxExportList[] = 'mv_disp_mvd';
    $wgAjaxExportList[] = 'mv_add_disp';
    $wgAjaxExportList[] = 'mv_remove_mvd';
    $wgAjaxExportList[] = 'mv_disp_remove_mvd';
    $wgAjaxExportList[] = 'mv_edit_disp';
    $wgAjaxExportList[] = 'mv_edit_preview';
    $wgAjaxExportList[] = 'mv_edit_submit';
    //$wgAjaxExportList[] = 'mv_history_disp';
    $wgAjaxExportList[] = 'mv_adjust_disp';
    $wgAjaxExportList[] = 'mv_adjust_submit';
    //sequence interface exported functions
    $wgAjaxExportList[] = 'mv_edit_sequence_submit';
    $wgAjaxExportList[] = 'mv_seqtool_disp';
    $wgAjaxExportList[] = 'mv_seqtool_clipboard';
    // search interface exported functions:
    $wgAjaxExportList[] = 'mv_expand_wt';
    $wgAjaxExportList[] = 'mv_pl_wt';
    $wgAjaxExportList[] = 'mv_submit_remove';
    $wgAjaxExportList[] = 'mv_tool_disp';
    $wgAjaxExportList[] = 'mv_date_obj';
    // media serving
    $wgAjaxExportList[] = 'mv_frame_server';
    /**********************************************/
    /***** register autoLoad Classes:		  *****/
    /**********************************************/
    // setup autoload classes:
    $wgAutoloadClasses['MV_Overlay'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_Overlay.php';
    $wgAutoloadClasses['MV_Component'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_Component.php';
    $wgAutoloadClasses['MV_MetavidInterface'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_MetavidInterface.php';
    $wgAutoloadClasses['MV_SequencePlayer'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_SequencePlayer.php';
    $wgAutoloadClasses['MV_SequenceTools'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_SequenceTools.php';
    $wgAutoloadClasses['MV_EditSequencePage'] = dirname(__FILE__) . '/MV_EditSequencePage.php';
    $wgAutoloadClasses['MV_VideoPlayer'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_VideoPlayer.php';
    $wgAutoloadClasses['MV_Tools'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_Tools.php';
    $wgAutoloadClasses['MV_Navigator'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_Navigator.php';
    $wgAutoloadClasses['MV_EditPageAjax'] = dirname(__FILE__) . '/MV_MetavidInterface/MV_EditPageAjax.php';
    $wgAutoloadClasses['MV_CategoryPage'] = dirname(__FILE__) . '/articlepages/MV_CategoryPage.php';
    $wgAutoloadClasses['MV_SequencePage'] = dirname(__FILE__) . '/articlepages/MV_SequencePage.php';
    $wgAutoloadClasses['MV_StreamPage'] = dirname(__FILE__) . '/articlepages/MV_StreamPage.php';
    $wgAutoloadClasses['MV_EditDataPage'] = $wgAutoloadClasses['MV_DataPage'] = dirname(__FILE__) . '/articlepages/MV_DataPage.php';
    $wgAutoloadClasses['MV_EditStreamPage'] = dirname(__FILE__) . '/MV_EditStreamPage.php';
    $wgAutoloadClasses['LogReader'] = dirname(__FILE__) . '/LogEventsList.php';
    $wgAutoloadClasses['LogViewer'] = dirname(__FILE__) . '/LogEventsList.php';
    $wgAutoloadClasses['MV_Title'] = dirname(__FILE__) . '/MV_Title.php';
    $wgAutoloadClasses['MV_Index'] = dirname(__FILE__) . '/MV_Index.php';
    $wgAutoloadClasses['MV_ImageGallery'] = dirname(__FILE__) . '/MV_ImageGallery.php';
    $wgAutoloadClasses['MV_Image'] = dirname(__FILE__) . '/MV_Image.php';
    $wgAutoloadClasses['MV_Stream'] = dirname(__FILE__) . '/MV_Stream.php';
    $wgAutoloadClasses['MV_StreamFile'] = dirname(__FILE__) . '/MV_StreamFile.php';
    $wgAutoloadClasses['MV_StreamImage'] = dirname(__FILE__) . '/MV_StreamImage.php';
    $wgAutoloadClasses['MV_MagicWords'] = dirname(__FILE__) . '/MV_MagicWords.php';
    /**********************************************/
    /***** register special pages hooks       *****/
    /**********************************************/
    $wgAutoloadClasses['MV_SpecialCRUDStream'] = dirname(__FILE__) . '/specials/MV_SpecialCRUDStream.php';
    $wgSpecialPages['Mv_Add_Stream'] = 'MV_SpecialCRUDStream';
    $wgAutoloadClasses['MV_SpecialListStreams'] = dirname(__FILE__) . '/specials/MV_SpecialListStreams.php';
    $wgSpecialPages['Mv_List_Streams'] = 'MV_SpecialListStreams';
    /* special export views */
    $wgAutoloadClasses['MV_SpecialExport'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
    $wgAutoloadClasses['MvVideoFeed'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
    $wgAutoloadClasses['MvExportStream'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
    $wgAutoloadClasses['MvExportSequence'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
    $wgAutoloadClasses['MvExportSearch'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
    $wgAutoloadClasses['MvExportAsk'] = dirname(__FILE__) . '/specials/MV_SpecialExport.php';
    $wgSpecialPages['MvVideoFeed'] = 'MvVideoFeed';
    $wgSpecialPages['MvExportStream'] = 'MvExportStream';
    $wgSpecialPages['MvExportSequence'] = 'MvExportSequence';
    $wgSpecialPages['MvExportSearch'] = 'MvExportSearch';
    $wgSpecialPages['MvExportAsk'] = 'MvExportAsk';
    $wgAutoloadClasses['MV_SpecialMediaSearch'] = dirname(__FILE__) . '/specials/MV_SpecialMediaSearch.php';
    $wgSpecialPages['Mv_List_Streams'] = 'MV_SpecialListStreams';
    $wgAutoloadClasses['MediaSearch'] = dirname(__FILE__) . '/specials/MV_SpecialMediaSearch.php';
    $wgSpecialPages['MediaSearch'] = 'MediaSearch';
    $wgSpecialPages['MV_SpecialSearch'] = 'MV_SpecialSearch';
    $wgAutoloadClasses['MVAdmin'] = dirname(__FILE__) . '/specials/MV_SpecialMVAdmin.php';
    $wgSpecialPages['MVAdmin'] = 'MVAdmin';
    // require_once( dirname(__FILE__) . '/specials/MV_SpecialCRUDStream.php');
    // require_once( dirname(__FILE__) . '/specials/MV_SpecialListStreams.php');
    // require_once( dirname(__FILE__) . '/specials/MV_SpecialExport.php');
    // require_once( dirname(__FILE__) . '/specials/MV_SpecialMediaSearch.php');
    // require_once( dirname(__FILE__) . '/specials/MV_SpecialMVAdmin.php');
    /**********************************************/
    /***** register hooks                     *****/
    /**********************************************/
    require_once $mvgIP . '/includes/MV_Hooks.php';
    // $wgHooks['ArticleSave'][] = 'mvSaveHook';
    $wgHooks['ArticleSaveComplete'][] = 'mvSaveHook';
    $wgHooks['ArticleDelete'][] = 'mvDeleteHook';
    $wgHooks['ArticleFromTitle'][] = 'mvDoMvPage';
    $wgHooks['TitleMoveComplete'][] = 'mvMoveHook';
    $wgHooks['LinkEnd'][] = 'mvLinkEnd';
    $wgHooks['LinkBegin'][] = 'mvLinkBegin';
    $wgHooks['MakeGlobalVariablesScript'][] = 'mvGlobalJSVariables';
    //our move function handles calling SMW hook
    foreach ($wgHooks['TitleMoveComplete'] as $k => $f) {
        if ($f == 'smwfMoveHook') {
            unset($wgHooks['TitleMoveComplete'][$k]);
        }
    }
    $wgHooks['SkinTemplateToolboxEnd'][] = 'mvAddToolBoxLinks';
    // introduced only in 1.13
    // @@NOTE this hook is not avaliable by default in medaiwiki
    // to use this hook you should add this function to moveTo()
    // right after the local check in Title.php:
    /*
     	 $err = wfRunHooks('TitleisValidMove', array( &$this, &$nt, &$wgUser, $auth));
    	 if( is_string( $err ) ) {
    		return $err;
    	 }
    */
    $wgHooks['TitleisValidMove'][] = 'mvisValidMoveOperation';
    $wgHooks['ParserAfterTidy'][] = 'mvParserAfterTidy';
    $wgHooks['CustomEditor'][] = 'mvCustomEditor';
    $wgParser->setHook(SEQUENCE_TAG, 'mvSeqTag');
    $wgParser->setFunctionHook('mvData', 'mvMagicParserFunction_Render');
    /*
     * OggHandler extension overrides
     * if the OggHandler is included remap the object for compatibility with metavid
     * MV_OggHandler.php handles all the re-mapping
     */
    if (isset($wgMediaHandlers['application/ogg'])) {
        if ($wgMediaHandlers['application/ogg'] == 'OggHandler') {
            $wgAutoloadClasses['mvOggHandler'] = dirname(__FILE__) . '/MV_OggHandler.php';
            $wgMediaHandlers['application/ogg'] = 'mvOggHandler';
            $wgParserOutputHooks['OggHandler'] = array('mvOggHandler', 'outputHook');
            foreach ($wgHooks['LanguageGetMagic'] as &$hook_function) {
                if ($hook_function == 'OggHandler::registerMagicWords') {
                    $hook_function = 'mvOggHandler::registerMagicWords';
                }
            }
            foreach ($wgExtensionCredits as &$ext) {
                if (isset($ext['name'])) {
                    if ($ext['name'] == 'OggHandler') {
                        $ext['description'] .= ' Integrated with the <b>MetaVidWiki Extension</b>';
                    }
                }
            }
        }
    }
    /************************************
     *  API extension (this may be integrated into semantic wiki at some point)
     **************************************/
    // $wgHooks['BeforePageDisplay'][] = 'mvDoSpecialPage';
    // $wgHooks['ArticleViewHeader'][] = 'mvArticleViewOpts';
    /**********************************************/
    /***** credits (see "Special:Version")    *****/
    /**********************************************/
    $wgExtensionCredits['other'][] = array('name' => 'MetaVidWiki', 'author' => 'Michael Dale', 'version' => MV_VERSION, 'url' => 'http://metavid.org/wiki/MetaVidWiki_Software', 'descriptionmsg' => 'mv-desc');
}
function mvSetupExtension(){
	global $mvVersion, $mvNamespace, $mvgIP, $wgHooks, $wgExtensionCredits, $mvMasterStore, 
	$wgParser, $mvArticlePath, $mvgScriptPath, $wgServer, $wgExtensionFunctions,$markerList,
	$mvEnableAutoComplete, $mvEnableJSLinkBack, $mvEnableJSMVDrewrite;
	

	mvfInitMessages();
	//add header for autoComplete if enabled: 
	if($mvEnableAutoComplete || $mvEnableJSLinkBack || $mvEnableJSMVDrewrite ){
		mvfAutoAllPageHeader();
	}
	
	/**********************************************/
	/***** register special pages hooks       *****/
	/**********************************************/		
	//@@todo shift over to extAddSpecial page (to avoid loading every time)
	require_once( dirname(__FILE__) . '/specials/MV_SpecialCRUDStream.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialListStreams.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialExport.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialMediaSearch.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialListSittings.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialAddSitting.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialEditSitting.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialUpload.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialUnusedStreamFiles.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialManageReaders.php');
	//require_once( dirname(__FILE__) . '/specials/MV_SpecialOrderStaff.php');
	require_once( dirname(__FILE__) . '/specials/MV_test.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialMVAdmin.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialManageReporters.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialSittingTypes.php');
	require_once( dirname(__FILE__) . '/specials/MV_SpecialCategories.php');
	/**********************************************/
	/***** register hooks                     *****/
	/**********************************************/
	require_once($mvgIP . '/includes/MV_Hooks.php');
	//$wgHooks['ArticleSave'][] = 'mvSaveHook';
	$wgHooks['ArticleSaveComplete'][] = 'mvSaveHook';
	$wgHooks['ArticleDelete'][] = 'mvDeleteHook';
	$wgHooks['ArticleFromTitle'][] = 'mvDoMvPage';			
		
	$wgHooks['TitleMoveComplete'][]='mvMoveHook';
	$wgHooks['TitleisValidMove'][]='mvisValidMoveOperation';	
	
	$wgHooks['ParserAfterTidy'][]='mvParserAfterTidy';	
	
	$wgHooks['CustomEditor'][] = 'mvCustomEditor';
	//$wgHooks['AddNewAccount'][] = 'mv_add_user';
	
	$wgParser->setHook( 'sequence', 'mvSeqTag' );

	//$wgHooks['BeforePageDisplay'][] = 'mvDoSpecialPage';
	
	
	/**********************************************/
	/***** credits (see "Special:Version")    *****/
	/**********************************************/
	$wgExtensionCredits['other'][] = array(
	    'name' => 'Metavid Wiki Extension',
	    'author' => 'Michael Dale',
	    'version' => 'alpha 0.1',
		'url' => 'http://metavid.org',
//<<<<<<< .mine
		'description' => 'Video Metadata Editor, Clip Sequencer and Media Search<br>' .
//<<<<<<< .mine
				'[http://metavid.ucsc.edu/wiki/index.php/System_Overview View Online Documentation]' .
				'Custom modifications for UNDESA done by Miano Njoka mianonjoka@gmail.com'
	);
	
	
	//undesa patch
	//setup global queue that is used to assign transcripts to reporters
	//is there a better way of doing this??
	/*
	if (!$alreadyInitialised)
	{
		global $reportersTable, $queue;
		$dbr =& wfGetDB(DB_SLAVE);
		$sql = 'SELECT id, order_number FROM '.$reportersTable.' ORDER BY order_number ASC';
		$result = $dbr->query($sql);
		$i = 0;
		while ($row=$dbr->fetchObject($result))
		{
			$queue[$i++] = $row->id;
		}
		$alreadyInitialised = true;	
	}
	*/
	//end undesa patch
}