function enviarform(){
var name= document.getElementById("nombre").value;
var Email= document.getElementById("email").value;
var Comments= document.getElementById("Comments").value;	
	
	
  conexion1=crearXMLHttpRequest();
  conexion1.onreadystatechange = procesarEventos;
/*
  conexion1.open('GET','email.php?name='+name+'&Email='+Email+'&Comments='+Comments, true);		
  conexion1.send(null);
*/  
  conexion1.open('POST','email.php', true);
  conexion1.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  conexion1.send(retornarDatos());
}

/*----- prosecera la repuesta del servidor -------*/
function procesarEventos()
{
  var resultados = document.getElementById("formulario");
  if(conexion1.readyState == 4)
  {
    resultados.innerHTML = conexion1.responseText;
  } 
 /*
  else 
  {
    resultados.innerHTML = '<img src="images/loading.gif" />';
  }
*/
}

//recuperar datos formularios
function retornarDatos()
{
  var cad='';
var name= document.getElementById("nombre").value;
var Email= document.getElementById("email").value;
var Comments= document.getElementById("Comments").value;
var lng= document.getElementById("lng_seccion").value;

  cad='name='+encodeURIComponent(name)+'&Email='+encodeURIComponent(Email)+'&Comments='+encodeURIComponent(Comments)+'&lng='+encodeURIComponent(lng);
  return cad;
}

//***************************************
//Funciones comunes a todos los problemas
//***************************************
function addEvent(elemento,nomevento,funcion,captura)
{
  if (elemento.attachEvent)
  {
    elemento.attachEvent('on'+nomevento,funcion);
    return true;
  }
  else  
    if (elemento.addEventListener)
    {
      elemento.addEventListener(nomevento,funcion,captura);
      return true;
    }
    else
      return false;
}

function crearXMLHttpRequest() 
{
  var xmlHttp=null;
  if (window.ActiveXObject) 
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  else 
    if (window.XMLHttpRequest) 
      xmlHttp = new XMLHttpRequest();
  return xmlHttp;
}


