// JavaScript Document
function objetoAjax()
	{
		var xmlhttp=false;
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
			   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E) {
				xmlhttp = false;
			}
		}
	
		if (!xmlhttp && typeof XMLHttpRequest!="ndefined") {
			xmlhttp = new XMLHttpRequest();
		}
		return xmlhttp;
	}
function enquisas(id,lng){
	var vacio=true;
	for (i=0;i<document.FormEnq.votacion.length;i++)
	{
		
		if (document.FormEnq.votacion[i].checked)
		{
			var votacion= document.FormEnq.votacion[i].value;
			vacio=false;
		}
	}
	if(vacio) alert("Erro: escolla unha opción para realizar a votación");
	else
	{
	    var parametros="id="+id+"&votacion="+votacion;
		  ajax=objetoAjax();
		  ajax.open("POST","ajax/enquisas.php?"+parametros,true);
		  ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
					document.location.href="index.php?ap=0&lng="+lng+"&cont=145";
			}
		  }
		  ajax.send(false);
	 }
}