function enviopregunta(id,pregunta,alias){
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = 'encuentros/preguntar.php?id_p='; //This is the path to the file we just finished making
        var puntua = '&pregunta_p='; //This is the path to the file we just finished making
        var sujeto = '&nombre_p='; //This is the path to the file we just finished making
    xmlhttp.open('GET', file + id + puntua + pregunta + sujeto + alias, true); //Open the file through GET, and add the id we want to retrieve as a GET variable
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved
                if ( content == 'x' ){
                      document.getElementById('formulario_div').innerHTML = "Sólo se permite una pregunta cada cinco minutos.<br><a class='btn_navega' href='javascript:document.location.reload();'>Nueva pregunta</a>"; //Set the inner HTML of the div with the old value in it to the new value **                	
                }
                else if( content != 'n' ){ //If the response was not "n" (meaning it worked)
                      document.getElementById('formulario_div').innerHTML = content; //Set the inner HTML of the div with the old value in it to the new value **
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}

function cambiar_ok(ide,idp,sino){
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = 'cambiar_ok.php?id_e='; //This is the path to the file we just finished making
        var puntua = '&id_p='; //This is the path to the file we just finished making
        var sujeto = '&sino='; //This is the path to the file we just finished making
    xmlhttp.open('GET', file + ide + puntua + idp + sujeto + sino, true); //Open the file through GET, and add the id we want to retrieve as a GET variable
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved
                if ( content == 'x' ){
                      document.location.reload(); //Set the inner HTML of the div with the old value in it to the new value **                	
                }
                else if( content != 'n' ){ //If the response was not "n" (meaning it worked)
                      document.location.reload(); //Set the inner HTML of the div with the old value in it to the new value **
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}

function borrar_pregunta(ide,idp){
	if(confirm("Confirme que desea eliminar la pregunta")){
		var xmlhttp=false; //Clear our fetching variable
	        try {
	                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
	        } catch (e) {
	                try {
	                        xmlhttp = new
	                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
	            } catch (E) {
	                xmlhttp = false;
	                        }
	        }
	        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
	        }
	        var file = 'borrar_p.php?id_e='; //This is the path to the file we just finished making
	        var puntua = '&id_p='; //This is the path to the file we just finished making
	    xmlhttp.open('GET', file + ide + puntua + idp, true); //Open the file through GET, and add the id we want to retrieve as a GET variable
	    xmlhttp.onreadystatechange=function() {
	        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
	                var content = xmlhttp.responseText; //The content data which has been retrieved
	                if ( content == 'x' ){
	                      document.location.reload(); //Set the inner HTML of the div with the old value in it to the new value **                	
	                }
	                else if( content != 'n' ){ //If the response was not "n" (meaning it worked)
	                      document.location.reload(); //Set the inner HTML of the div with the old value in it to the new value **
	                }
	        }
	        }
	        xmlhttp.send(null) //Nullify the XMLHttpRequest
		return;
	}
}

function editar_p(ide,idp){
	window.top.frames['centro_p'].location="centro_p.php?id_encu="+ide+"&id_preg="+idp+"&op=edit";
}

function modificar_pregunta(ide,idp,textop){
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = 'modificar_p.php?id_e='; //This is the path to the file we just finished making
        var puntua = '&id_p='; //This is the path to the file we just finished making
        var sujeto = '&texto_p='; //This is the path to the file we just finished making
    xmlhttp.open('GET', file + ide + puntua + idp + sujeto + textop, true); //Open the file through GET, and add the id we want to retrieve as a GET variable
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved
                if ( content == 'x' ){
                      window.top.document.location.reload(); //Set the inner HTML of the div with the old value in it to the new value **                	
                }
                else if( content != 'n' ){ //If the response was not "n" (meaning it worked)
                      window.top.document.location.reload(); //Set the inner HTML of the div with the old value in it to the new value **
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}

function responder_p(ide,idp){
	window.top.frames['centro_p'].location="centro_p.php?id_encu="+ide+"&id_preg="+idp+"&op=responder";
}

function responder_pregunta(ide,idp,textor){
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = 'responder_p.php?id_e='; //This is the path to the file we just finished making
        var puntua = '&id_p='; //This is the path to the file we just finished making
        var sujeto = '&texto_r='; //This is the path to the file we just finished making
    xmlhttp.open('GET', file + ide + puntua + idp + sujeto + textor, true); //Open the file through GET, and add the id we want to retrieve as a GET variable
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved
                if ( content == 'x' ){
                      window.top.document.location.reload(); //Set the inner HTML of the div with the old value in it to the new value **                	
                }
                else if( content != 'n' ){ //If the response was not "n" (meaning it worked)
                      window.top.document.location.reload(); //Set the inner HTML of the div with the old value in it to the new value **
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}

function despedir_p(ide){
	window.top.frames['centro_p'].location="centro_p.php?id_encu="+ide+"&op=despedir";
}

function despedida(ide,textod){
var xmlhttp=false; //Clear our fetching variable
        try {
                xmlhttp = new ActiveXObject('Msxml2.XMLHTTP'); //Try the first kind of active x object…
        } catch (e) {
                try {
                        xmlhttp = new
                        ActiveXObject('Microsoft.XMLHTTP'); //Try the second kind of active x object
            } catch (E) {
                xmlhttp = false;
                        }
        }
        if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
                xmlhttp = new XMLHttpRequest(); //If we were able to get a working active x object, start an XMLHttpRequest
        }
        var file = 'despedir.php?id_e='; //This is the path to the file we just finished making
        var sujeto = '&texto_d='; //This is the path to the file we just finished making
    xmlhttp.open('GET', file + ide + sujeto + textod, true); //Open the file through GET, and add the id we want to retrieve as a GET variable
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4) { //Check if it is ready to recieve data
                var content = xmlhttp.responseText; //The content data which has been retrieved
                if ( content == 'x' ){
                      window.top.document.location.reload(); //Set the inner HTML of the div with the old value in it to the new value **                	
                }
                else if( content != 'n' ){ //If the response was not "n" (meaning it worked)
                      window.top.document.location='/'; //Set the inner HTML of the div with the old value in it to the new value **
                }
        }
        }
        xmlhttp.send(null) //Nullify the XMLHttpRequest
return;
}

function validar_formu(){
	seguir=1;
	if(document.getElementById('preguntax').value == ''){
		seguir=0;
		alert('Debe escribir una pregunta');
	}
	else if(document.getElementById('nombre').value == ''){
		seguir=0;
		alert('Debe escribir un nombre o alias');
	}
	if(seguir == 1){	
		return(true);
	}
	else{
		return(false);
	}
}

function comp_enter(e){
	if(window.event) // IE
	  {
	  keycode = e.keyCode;
	  }
	else if(e.which) // Netscape/Firefox/Opera
	  {
	  keycode = e.which;
	  }	
	//alert(keycode);
	// pulsamos el enter
	if(keycode == 13)
	{
	  document.getElementById('enviar_pregunt').focus();
	}
}