function init()
{
	var currentSetting = System.Gadget.Settings.read("ResultsIn");

	if (currentSetting != "")
	{
		if (currentSetting == 'degrees')
		{
			degrees.checked = true;
		}
		else
		{
			radians.checked = true;
		}
	}
	else
	{
		degrees.checked = true;
	}
}

System.Gadget.onSettingsClosing = SettingsClosing;

function SettingsClosing(event)
{
	if (event.closeAction == event.Action.commit)
	{
		if (degrees.checked)
		{
			System.Gadget.Settings.write("ResultsIn", degrees.value);
		}
		else
		{
			System.Gadget.Settings.write("ResultsIn", radians.value);
		}
	}
	
	event.cancel = false;
}