//Desarrollado por Jesus Liñán
//webmaster@ribosomatic.com
//ribosomatic.com
//Puedes hacer lo que quieras con el código
//pero visita la web cuando te acuerdes

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 enviarDatos(){

	//valores de los inputs
	nom=document.testimonios.nombre.value;
	email=document.testimonios.email.value;
	//tes=document.testimonios.testimonio.value;
	tes=document.getElementById('testimonio').value;
	fecha=document.testimonios.fecha.value;
	idioma=document.testimonios.idioma.value;
	control=document.testimonios.control.value;
	
	

	
	if(nom != ''  && control != '' ){
		
	
		
	divResultado = document.getElementById('informe');
	divResultado.innerHTML= '<img src="http://www.laleonaecolodge.com/images/carga.gif">';
			
	ajax=objetoAjax();

	ajax.open("POST", "http://www.laleonaecolodge.com/includes/registro.php",true);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
			divResultado.innerHTML = ajax.responseText;
	
		}
	}
	ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	ajax.send("nom="+nom+"&email="+email+"&tes="+tes+"&fecha="+fecha+"&control="+control+"&idioma="+idioma);
	

		
		}else{
          alert('Hay campos vacios. -> There are empty fields.');
		}
	
	
	
}

function LimpiarCampos(){
	document.testimonios.nombre.value="";
	document.testimonios.email.value="";
	document.testimonios.testimonio.value="";
	document.testimonios.control.value="";
	document.testimonios.nombre.focus();
}