function checkQuestion(id_question)
{
	$('checked_question').value = id_question;
}

function vote()
{
	if ($('checked_question').value == "none")
	{
		alert('Alegeti o varianta de raspuns');
		return false;
	}
	else
	{
		var url = settings['URL']+"/library/ajax/handlePolls.php?action=vote&id_poll_question=" + $('checked_question').value + "&id_poll=" + $('id_poll').value;
		
		new Ajax(url, {
			method: 'get',
			onComplete: function(text, xml) 
			{
				if (messages_values.contains(text))
				{
					alert(errorMessages[text]);
				}
				else
				{
					$('poll_content').innerHTML = "";
					$('poll_content').innerHTML = text;
				}
			}
		}).request();
	}
}

function Poll_Vote() {
	var form = $('pageForm');
	var url = settings['URL']+"/library/ajax/handlePolls.php?action=pageVote";
	form.action = url;
	form.method = "POST";
	form.send({
		onComplete: function(text, xml) {
			alert(text);
		}
	});
}

function getResults()
{
	var url = settings['URL']+"/library/ajax/handlePolls.php?action=getResults&id_poll=" + $('id_poll').value;
		
		new Ajax(url, {
			method: 'get',
			update: 'poll_content'
		}).request();
	
}