var ajax;
var goVote = true;

function nuevo_ajax()
{
	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!='undefined') { xmlhttp=new XMLHttpRequest(); }

	return xmlhttp;
}

function respuesta_votar() {
	if (ajax.readyState == 4) {
		if (ajax.status == 200) {
			var retorno = ajax.responseText;
			if(retorno=='OK'){
				document.getElementById('spanVotar').innerHTML = '<div class="yeah"></div>';
				//document.getElementById('votame').style.marginRight='23px';
				
				//alert("OLE");
			} else {
				alert(retorno);
			}
			goVote = true;
		} else {
			goVote = true;
		}
	}
}

function votar(id){	
	if(goVote){
		ajax=nuevo_ajax();
		ajax.onreadystatechange = respuesta_votar;
		ajax.open("GET", '/blog/includes/ajax_votar.php?id='+id, true);
		ajax.send(null);
		goVote = false;
	}

}
