function onLoadForm(widget)
{
	widget.addEventListener("submitted", function()
	{
		if (widget.form.userId && typeof widget.form.userId.value == "string")
		{
			var userId = widget.form.userId.value;
			document.getElementById("form"+widget.item.id).style.display = "none";
			
			xajax.call("xajax_processSurvey", {parameters:[userId], context: {callback: function()
			{
				location.href = location.href + (location.href.indexOf("?") > -1 ? "&" : "?") + "submit=" + widget.item.name.toLowerCase().replace(" ", "_");
			}}});
		}
		else
		{
			location.href = location.href + (location.href.indexOf("?") > -1 ? "&" : "?") + "submit=" + widget.item.name.toLowerCase().replace(" ", "_");
		}
	});
}

function checkOtherField(selectBox, qId)
{
	if (document.getElementById("checkField" + qId) != undefined)
	{
		if (selectBox.selectedIndex == selectBox.options.length - 1)
		{
			document.getElementById("checkField" + qId).disabled = false;
		}
		else
		{
			document.getElementById("checkField" + qId).disabled = true;
		}
	}
}
