function watch_checkboxes(wrapper)
{
	// search for checkbox inside the same question wrapper
	var checkbox = wrapper.find(":checkbox");
	if (checkbox.length)
	{
		if (wrapper.find(":radio:not(.sorag_extra *):checked").parent().hasClass("missing"))
		{
			checkbox.get(0).checked = false;
			checkbox.get(0).disabled = true;
		}
		else
		{
			// activate checkbox again
			checkbox.get(0).disabled = false;
		}
		
		if (wrapper.find(".sorag_suboptions :checked").length)
		{
			checkbox.get(0).checked = true;
			checkbox.get(0).disabled = true;
		}
	}
}

$(function()
	{
		// add event listeners to all radios
		$(".sorag_option :radio").bind("click", function()
			{
				setTimeout(function(){watch_checkboxes($(this).parents(".sorag_item"))}.bind(this), 1);
			}
		);
	}
);
