function pollInit()
{
	$('#voteBtn').click(function()
	{
		// get cookie
		if ($.cookie('cookie_' + $("#pollID").val()) == null)
		{
			
			submitForm();
			createCookie();
		}
		else
		{
			alert("Sorry, you've already voted in this poll!");
		}
		
	});
}

function submitForm()
{
	$.ajax({
		type: "post",
		url: "php/ajax_poll.php",
		data: 	$("#voteForm").serialize(),
		success: function(html){
			$("#thanksVoting").html('Thanks for voting!');
		}
	});
}

function createCookie()
{
	 $.cookie('cookie_' + $("#pollID").val(), 'test');
}

