
function disipar(valor) 
{
var divmsjvotar=document.getElementById(valor);
divmsjvotar.innerHTML="";
} 
function cambiarvoto(valor) 
{
var divmsjvotar=document.getElementById(valor);
divmsjvotar.innerHTML="";
} 


function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	var xmlhttp=false; 
	try 
	{ 
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			// Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!="undefined") { xmlhttp=new XMLHttpRequest(); } 

	return xmlhttp; 
}

function votar(tipo,valora)
{
	valor = "msj"+valora;
	divpuntos = "spv"+valora;

	var divmsjvotar=document.getElementById(valor);
	var divmsjpuntos=document.getElementById(divpuntos);
	divmsjvotar.innerHTML="Enviando voto ...";
	divmsjpuntos.innerHTML = "<img src='imagenes/ajaxloader.gif'/>";
	
		var ajax=nuevoAjax();
		ajax.open("POST", "votar.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		//ajax.send(evento+"="+valor);
		//ajax.send(tipo+"="+valor);
		ajax.send("ingreso="+valora+"&tipo="+tipo);
		
		ajax.onreadystatechange=function()
		{
			if (ajax.readyState==4)
			{
	respuesta = ajax.responseText.split(":");
		divmsjvotar.innerHTML= respuesta[0]; // respuesta:votosnuevos
	divmsjpuntos.innerHTML= respuesta[1];
	
				setTimeout("disipar('" + valor + "')",3000);
				
			}
		}
	}

