function submitPoll(id) {
	var data = $('#poll_' + id).serialize();
	$.post("/poll/submit/" + id, data, function(result) {
		eval(result);
		showPollResults(id);
		$('#poll_' + id + '_submit').css('display', 'none');
	});
}

function checkPollCookie(id) {
	var c = $.cookie('poll_' + id);
	if (c == '') {
		showPoll(id);
		return;
	}
	$.post("/poll/check/" + id + "/" + c, '', function(result) {
		eval(result);
	});
}

function showPoll(id) {
	$('#poll_' + id).css('display', 'block');
	$.shadows("refresh");
}

function showPollResults(id) {
	$.post("/poll/results/" + id, '', function(result) {
		$('#poll_' + id).html(result);
		showPoll(id);
	});
}

