function nuevoAjax(){
	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 comentar(id){
	t1 = document.getElementById('fname').value;
	t2 = document.getElementById('ftitle').value;
	t3 = document.getElementById('ftext').value;
	if (t1==''){
		alert("Tu nombre es un campo obligatorio");		
	}else{
		var contenedor;
		contenedor = document.getElementById('contribution');
		contenedor.innerHTML = '<p><img src="./img/loading.gif"></p>';
		ajax=nuevoAjax();
		ajax.open("POST", "aj_comentario.php",true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) {
			contenedor.innerHTML = ajax.responseText;
			//document.getElementById('contribution').style.visibility = 'hidden';
		 	}
		}
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		ajax.send("t1="+escape(t1)+"&t2="+escape(t2)+"&t3="+escape(t3)+"&t4="+escape(id));
	}
}
