function Poll()
{
	var PollHtml = CurrentPoll.GetCurrentPoll().value;
	if (PollHtml == "")
	{
		document.getElementById("NoPollTodayText").style.display = "";
		document.getElementById("lnkSubmit").style.display = "none";
	}
	else
	{
		document.getElementById('PollId').value = parseInt(PollHtml.substring(0,PollHtml.indexOf('|')));
		var start = PollHtml.indexOf('|') + 1;
		PollHtml = PollHtml.substring(start, PollHtml.length - start);
	}
	
	document.getElementById("CurrentPoll").innerHTML = PollHtml;
	
	document.getElementById("CurrentPollResults").innerHTML = CurrentPoll.GetCurrentPollAndResults().value;
}

function NoPoll()
{
	document.getElementById("CurrentPoll").style.display = "none";
	document.getElementById("lnkSubmit").style.display = "none";
	document.getElementById("PollThankYouText").style.display = "";
	
	document.getElementById("CurrentPollResults").innerHTML = CurrentPoll.GetCurrentPollAndResults().value;
}

function SubmitResponse()
{
	var options = document.getElementsByTagName("input");
	var result;
	var PollId = parseInt(document.getElementById('PollId').value);
	for (i = 0; i < options.length; i++)
	{
		if (options[i].type == "radio")
		{
			if (options[i].checked == true)
			{
				result = options[i].value;
				CurrentPoll.RecordResponse(PollId, parseInt(result));
				document.getElementById("CurrentPoll").style.display = "none";
				document.getElementById("lnkSubmit").style.display = "none";
				document.getElementById("PollThankYouText").style.display = "";
				document.getElementById("CurrentPollResults").innerHTML = CurrentPoll.GetCurrentPollAndResults().value;
			}
		}
	}
}
