//  JavaScript Document
//  sond3 diseņo&desarrollo
//  www.sond3.com  


function validarContacto(){
  
   var envio = document.getElementById("envio");
   var envioValue = envio.value;
   envio.disabled = true;
   envio.value="Enviando...";
  
   var sendForm = true;
   var msn = "Compruebe el formulario:\n\n";
  
  var valor = document.getElementById("nombre").value;
  if( valor == null || valor.length == 0 || /^\s+$/.test(valor) ) {
		msn += " - EL nombre es obligatorio\n";
		sendForm=false;
  }

  var valor = document.getElementById("texto").value;
  if( valor == null || valor.length == 0 || /^\s+$/.test(valor) ) {
		msn += " - Completa el mensaje\n";
		sendForm=false;
  }
  
  //email no obligatorio sintaxis 
  var valor = document.getElementById("mail").value;
  if( valor == null || valor.length == 0 || /^\s+$/.test(valor) ) {
  }else{
	  if( !(/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(valor)) ) {
			msn += " - La direccion de correo electronico no es correcta\n";
			sendForm=false;
		}
  }
  
	
  if(sendForm==false){
	alert(msn);
	envio.disabled = false;
    envio.value= envioValue;
	return false;
  }	

	
}
