	function show_poll ()
	{
			var id_poll = $("#id_poll").val();



		$.ajax({
			type: "POST",
			url: "/_modules/poll_show.php",
			data: "id_poll="+id_poll,
			cache: false,
			success: function(html){
				$("#divpoll").html(html);
			$("#divpoll").show('slow');
			}

		});

	}
//

	$(document).ready(function(){
	show_poll();	

			$('#ResultVote').click(function(){
				var id_poll = $("#id_poll").val();

				$.ajax({
					type: "POST",
					url: "/_modules/poll_show.php",
					data: "id_poll="+id_poll+"&res=1",
					cache: false,
					success: function(html){
						$("#divpoll").html(html);
					$("#divpoll").show('slow');
					}

				});

			});

		// контроль и отправка данных на сервер в фоновом режиме при нажатии на кнопку "отправить сообщение" при отправке сообщений
		$("#pollForm").submit(function(){


			var id_poll = $("#id_poll").val();
                        var poll = $("input[@name='poll']:checked").attr("value");
			if (poll ==undefined)
			{
				alert ("Вы не выбрали вариант для ответа!");
				return false;
			}
			$("#divpoll").hide('slow', function(){
				$.ajax({
					type: "POST",
					url: "/_modules/poll_add.php",
					data: "id_poll="+id_poll+"&poll="+poll,
					success: function(divpoll){
						show_poll();
				   }

				});
			});
			return false;
		});




	});
function PollResults(res)
	{
	 
	 $("#divpoll").hide('slow', function(){
				var id_poll = $("#id_poll").val();

				$.ajax({
					type: "POST",
					url: "/_modules/poll_show.php",
					data: "id_poll="+id_poll+"&res="+res,
					cache: false,
					success: function(html){
						$("#divpoll").html(html);
					$("#divpoll").show('slow');
					}

				});



	 });
	}

