var eVoto = 0;

function enq_setVoto(voto)
{
	eVoto = voto;
}

function enq_votar(enq)
{
	if( eVoto != 0 && eVoto != "" )
	{
		$.get("ajax/varios.php", 
			{ codEnq: enq, voto: eVoto, opt: "enq_votar" }, 
			function(retorno)
			{ 
				$("#enquete_centro").html(retorno);
			} 
		);

		eVoto = 0;
	}
	else
	{
		alert('Você precisa selecionar uma opção!');
	}
	
	return false;
}

function enq_resultado(enq)
{
	carregando("#enquete_centro", 1);
	
	$.get("ajax/varios.php", 
		{ codEnq: enq, opt: "enq_resultado" }, 
		function(retorno)
		{ 
			$("#enquete_centro").html(retorno);
		} 
	);
}

function enq_ver(enq)
{
	// Mostra a camada com efeito de transparencia
	flutuante();

	var mostrar = "";
	mostrar += "<div id='enq' onClick='javascript:fechar();' class='caixa_flutuante'>";
		mostrar += "<h1>Resultado da Enquete</h1>";
		mostrar += "<br><div id='enq_res'>";
		mostrar += "</div>";
		mostrar += "<div>";
			mostrar += "<center><a href='javascript:fechar();'><img src='imagens/bt_fechar.gif' class='bt_borda'></a></center>";
		mostrar += "</div>";
	mostrar += "</div>";

	// Escreve e mostra o painel com a enquete
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 15);

	$("#painel").html("");
	$("#painel").html(mostrar);
	$("#enq").css({left: ((screen.width - 280) / 2) + "px"});
	$("#enq").css({top: lightboxTop + "px"});

	$.get("ajax/varios.php", 
		{ codEnq: enq, opt: "enq_resultado" }, 
		function(retorno)
		{ 
			$("#enq_res").html(retorno);
		} 
	);

	$("#painel").css({visibility:"visible"});
}
