var app_data_path = "";
var pref_file_path = null;
var IsAsSingle = false;
var mccoreDoc = null;
function getAppdataDir()
{
	if(app_data_path)
		return app_data_path;
	return null;
}

function getMcexPrefPath()
{
    if(pref_file_path)
        return pref_file_path;
	return null;
}

function initialize()
{

	if(!mccoreDoc){
		//alert(path.path);
        mccoreDoc = LoadPrefDocByPath("xslt/mccore.xml");
    }
     
    const Ci = Components.interfaces;
    const Cc = Components.classes;
    const IID_Prefs = "@mozilla.org/preferences-service;1";
    var prefs = Cc[IID_Prefs].getService(Ci.nsIPrefBranch);
    app_data_path =  prefs.getCharPref("coder.pref.start.path");

	nsCommandLine = window.arguments[0].QueryInterface(Components.interfaces.nsICommandLine);
	 if(nsCommandLine.length > 0) {
		const nsCI               = Components.interfaces;
		const nsIWebNavigation   = nsCI.nsIWebNavigation;
		app_data_path =  nsCommandLine.getArgument(0);
		LOCAL_PREF_DIR = "";
		if (nsCommandLine.length > 2) {
			switch (nsCommandLine.getArgument(1)) {
			case "-port":
				mcport = parseInt(nsCommandLine.getArgument(2));
				break;
			}	
		}
	}
    
    //$e('adv_pref_panel_all').setAttribute('hidden',false);
    //add default preset from mediacoder
    var children = $e("lpf_tree_children");
    var item = HtmHelper.make("treeitem");
    item = children.appendChild(item);
    var row = item.appendChild( HtmHelper.make("treerow"));
    var title = "[Current Settings]";
    var cell = row.appendChild( HtmHelper.make("treecell", {"label":title,"value":"mcfile.xml","mtype":"mcfile","src":img_src_file}));
    //
    InitPrefTreeList();
    
    $e("LocalPreserFileTree").view.selection.select(1);
}

function unInit()
{
}