function objetoAjax(){
  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 enviarDatosSugiere(){
  divResultado = document.getElementById('resultado');
  divFormulario = document.getElementById('formulario');
  titulo=document.frmsugiere.titulo.value;
  autor=document.frmsugiere.autor.value;
  editorial=document.frmsugiere.editorial.value;
  isbn=document.frmsugiere.isbn.value;
  mensaje=document.frmsugiere.mensaje.value;
  ajax=objetoAjax();
  divResultado.innerHTML = '<p style="text-align:center;"><img src="../images/loading.gif"/></p>'; 
  ajax.open("POST", "sugiere/procesar.php",true);
  ajax.onreadystatechange=function(){
  	if (ajax.readyState==4){
  		divResultado.innerHTML = ajax.responseText;
		
		divFormulario.style.display="block";

/*  		divFormulario.innerHTML = "<p style="border:1px solid red; width:400px;">La actualizaci&oacute;n se realiz&oacute; correctamente</p>";
*/ 	}
  }
  ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  ajax.send("titulo="+titulo+"&autor="+autor+"&editorial="+editorial+"&isbn="+isbn+"&mensaje="+mensaje);
}

