// JavaScript Document
function checkForm() {
name = document.getElementById("name").value;
  email = document.getElementById("email").value;
   fono = document.getElementById("fono").value;
    comment = document.getElementById("comment").value;
 
  if (name == "") {
  hideAllErrors();
document.getElementById("nameError").style.display = "inline";
document.getElementById("name").select();
document.getElementById("name").focus();
  return false;
  }

else if (email == "") {
hideAllErrors();
document.getElementById("emailError").style.display = "inline";
document.getElementById("email").select();
document.getElementById("email").focus();
  return false;
  } 
else if (comment == "") {
hideAllErrors();
document.getElementById("commentError").style.display = "inline";
document.getElementById("comment").select();
document.getElementById("comment").focus();
  return false;
  }
  //------------------------------------------------------------
else if (email != "") {
var ingreso = new String()	
ingreso = email
if(!ingreso.match("@"))
	{ alert("Ingrese una direccion de correo valida")
	document.getElementById("email").focus();
	return false
	}

if (!ingreso.match("."))
	{ alert("Ingrese una direccion de correo valida")
	document.getElementById("email").focus();
	return false
	}
  } 
 //-------------------------------------------------------------------------------------------------------------------------------------

  var checkOK = "0123456789";
  var checkStr = fono;
  var allValid = true;
  var decPoints = 0;
  var allNum = "";
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
    allNum += ch;
  }
  if (!allValid)
  {
    alert("Escriba sólo dígito validos en el campo \"Telefono\".");
   document.getElementById("fono").focus();
    return false
  }	
	 
	
//-------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------

  return true;
  }
 
  function hideAllErrors() {
document.getElementById("nameError").style.display = "none"
document.getElementById("emailError").style.display = "none"
document.getElementById("commentError").style.display = "none"
  }
