window.configInfo = {
	load: function (pnlDiv, addon) {
		this.config = app.getValue('refreshSkinButton_config', {
			showToolbarIcon: true,
			autoRegisterHotkey: true,
			defaultAction: 0,
		});
		
		var UI = getAllUIElements(pnlDiv);
		
		UI.chbShowToolbarIcon.controlClass.checked = this.config.showToolbarIcon;
		UI.chbAutoRegisterHotkey.controlClass.checked = this.config.autoRegisterHotkey;
		UI.chbDefault0.controlClass.checked = (this.config.defaultAction == 0) ? true : false;
		UI.chbDefault1.controlClass.checked = (this.config.defaultAction == 1) ? true : false;
		UI.chbDefault2.controlClass.checked = (this.config.defaultAction == 2) ? true : false;
	},
	save: function(pnlDiv, addon) {
		var UI = getAllUIElements(pnlDiv);
		this.config.showToolbarIcon = UI.chbShowToolbarIcon.controlClass.checked;
		this.config.autoRegisterHotkey = UI.chbAutoRegisterHotkey.controlClass.checked;
		this.config.defaultAction = 
            (UI.chbDefault0.controlClass.checked) ? 0 : 
            (UI.chbDefault1.controlClass.checked) ? 1 : 2;
		
		// Save config
		app.setValue('refreshSkinButton_config', this.config);
		
		// get functions from the main window
		var registerHotkeyFunc = app.dialogs.getMainWindow().getValue('refreshSkinButton_autoRegisterHotkey');
		var showToolbarIconFunc = app.dialogs.getMainWindow().getValue('refreshSkinButton_showToolbarIcon');
		
		// Execute the register-hotkey and show-icon functions with the new configuration
		if (registerHotkeyFunc) registerHotkeyFunc(this.config);
		if (showToolbarIconFunc) showToolbarIconFunc(this.config);
	}
}