function Nuevo(){
	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 rankear(id,votos) {
       ajax=Nuevo(); 
       ajax.open("POST", "/ajax/rankear.php");
       ajax.onreadystatechange=function() {
       if (( ajax.readyState==4) && ( ajax.status == 200 )) { 
			if (ajax.responseText != "no") {
				insertarnuevo(ajax.responseText,id);
			} else {
				insertarnuevo(votos,id);
			}
       }
}
       ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send("voto="+id);
}
function insertarnuevo(rank,id){
document.getElementById("votos-"+id).innerHTML = '<span><strong>'+rank+'</strong><br />votos<br /></span><input class="boton votar" type="button" value="votado!" />';
}
function rankeando(id,votos) {
       ajax=Nuevo(); 
       ajax.open("POST", "/ajax/rankear.php");
       ajax.onreadystatechange=function() {
       if (( ajax.readyState==4) && ( ajax.status == 200 )) { 
			if (ajax.responseText != "no") {
				insertarnuevor(ajax.responseText,id);
			} else {
				insertarnuevor(votos,id);
			}
       }
}
       ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send("voto="+id);
}
function insertarnuevor(rank,id){
	if (document.getElementById('ranking').value == 'Votado') { return false; }
document.getElementById("votos-"+id).innerHTML = '<strong>'+rank+'</strong>';
document.getElementById('ranking').value = 'Votado';
}

function sendtrack(id) {
		url = document.getElementById("urli").value;
       ajax=Nuevo(); 
       ajax.open("POST", "/ajax/addpingback.php");

       ajax.onreadystatechange=function() {
       if (( ajax.readyState==4) && ( ajax.status == 200 )) { 
			if (ajax.responseText != "ok")
		{
			cerrar();
			setTimeout("htmlLightbox('/html-lightbox/error.php?error='+ajax.responseText);","1000");
			
       }
	   else
	   {
	   		cerrar();
			setTimeout("htmlLightbox('/html-lightbox/trackback.html');","1000");
			
	   }
	 }
}
       ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send("id="+id+"&url="+url);
}


function recomendar(id) {
		temail = document.getElementById("temail").value;
		emaila = document.getElementById("emaila").value;
		nombre = document.getElementById("nombree").value;
		comentarios = document.getElementById("comentarioss").value;
		
       ajax=Nuevo(); 
       ajax.open("POST", "/ajax/recomendar.php");

       ajax.onreadystatechange=function() {
       if (( ajax.readyState==4) && ( ajax.status == 200 )) { 
			if (ajax.responseText != "ok")
		{
			cerrar();
			setTimeout("htmlLightbox('/html-lightbox/error.php?error='+ajax.responseText);","1000");
			
       }
	   else
	   {
	   		cerrar();
			setTimeout("htmlLightbox('/html-lightbox/recomendar.html');","1000");
			
	   }
	 }
}
       ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send("id="+id+"&temail="+temail+"&emaila="+emaila+"&comentarios="+comentarios+"&nombre="+nombre);
}