$(function(){
	var poll_cookie=$.cookie('pollvote');
	var poll_id=$("#poll_id").val();
	if (poll_cookie!=poll_id)
	{
		$("#pollvote").mousedown( function () {
			if ($(".poll_option:checked").length==0)
				return false;
				
			$(this).attr("disabled","true");
			
			if (poll_cookie!=poll_id)
			{
				var pars='';
				pars=addPostParam(pars, "action", "add_poll_vote_get_res");
				pars=addPostParam(pars, "poll_id", poll_id);
				pars=addPostParam(pars, "poll_option_id", $(".poll_option:checked").val());
				$.cookie('pollvote', poll_id, { expires: 7, path: '/', domain: 'recruiter.pl' });
//				$.cookie('pollvote', poll_id, { expires: 7, path: '/' });
				$.ajax({
					type: "POST",
					url: window.location.href,
					data: pars,
					beforeSend: function(){
									$("#poll_container").
									fadeOut("normal").
									html('<p class="poll_loader"><img src="i/ajax-loader.gif" /></p>').
									fadeIn("normal");
/*									$("#poll_loader").
									fadeIn("normal");
									$("#poll_container").
									fadeOut("normal", function() {
										$("#poll_loader").
										fadeIn("normal");
									} );*/
					},
					success: function(sData){
								if (sData!=false)
								{
/*									$("#poll_loader").
									fadeOut("normal");*/
									$("#poll_container").
									fadeOut("normal").
									html(sData).
									fadeIn("normal");
/*									$("#poll_loader").
									fadeOut("normal", function() {
										$("#poll_container").
										html(sData).
										fadeIn("normal");
									} );*/
								}
								else
									alert("Błąd!");
							}
				});
				
			}
		});
	}
	
/*	$("#navigation li")
	.mouseover(function() {
		$(this).addClass("sfhover");
	})
	.mouseout(function() {
		$(this).removeClass("sfhover");
	});*/
});
