var prefManager = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);

function closebuttonDoIt() {
	var prefString = prefManager.getCharPref("extensions.closebutton.command");
	switch (prefString) {
		case "close_t": gBrowser.removeCurrentTab();
			break;
		case "close_w": BrowserTryToCloseWindow();
			break;
		case "close_ff": goQuitApplication();
			break;
		default: gBrowser.removeCurrentTab();
	};
}
