+static qboolean CL_Gecko_Embedding_Init (void)
+{
+ char profile_path [MAX_OSPATH];
+ OSGK_GeckoResult grc;
+ OSGK_EmbeddingOptions *options;
+ OSGK_ScriptObjectTemplate* dpGlobalTemplate;
+
+ if (!osgk_dll) return false;
+
+ if( cl_geckoembedding != NULL ) return true;
+
+ Con_DPrintf( "CL_Gecko_Embedding_Init: setting up gecko embedding\n" );
+
+ options = osgk_embedding_options_create();
+#ifdef XULRUNNER_DIR_SUFFIX
+ osgk_embedding_options_add_search_path( options, "./xulrunner-" XULRUNNER_DIR_SUFFIX "/" );
+#endif
+ osgk_embedding_options_add_search_path( options, "./xulrunner/" );
+ dpsnprintf (profile_path, sizeof (profile_path), "%s/xulrunner_profile/", fs_gamedir);
+ osgk_embedding_options_set_profile_dir( options, profile_path, 0 );
+ cl_geckoembedding = osgk_embedding_create_with_options( options, &grc );
+ osgk_release( options );
+
+ if( cl_geckoembedding == NULL ) {
+ Con_Printf( "CL_Gecko_Embedding_Init: Couldn't retrieve gecko embedding object (%.8x)!\n", grc );
+ return false;
+ }
+
+ Con_DPrintf( "CL_Gecko_Embedding_Init: Embedding set up correctly\n" );
+
+ dpGlobalTemplate = osgk_sot_create( cl_geckoembedding, dpGlobal_create, NULL, NULL );
+
+ osgk_sot_add_function (dpGlobalTemplate, "query", 0, dpGlobal_query);
+
+ osgk_sot_register (dpGlobalTemplate, cl_geckoembedding, "Darkplaces", 0);
+ osgk_release( dpGlobalTemplate );
+
+ return true;
+}
+
+clgecko_t * CL_Gecko_CreateBrowser( const char *name, int ownerProg ) {