//CONTACTO
function validaContacto(){
    if (isBlanco(document.contactoForm.nombre.value)){
       alert("Debe indicar su nombre");
       window.document.contactoForm.nombre.select();
       return false;
       }
    
    if (!isValidEmail(document.contactoForm.email.value)){
       alert("\"" + document.contactoForm.email.value + "\" no es un e-mail válido!");
       window.document.contactoForm.email.focus();
       window.document.contactoForm.email.select();
       return false;
       }
	if (isBlanco(document.contactoForm.asunto.value)){
       alert("Debe indicar un asunto");
       window.document.contactoForm.asunto.select();
       return false;
       }
	if (isBlanco(document.contactoForm.mensaje.value)){
       alert("Debe indicar un mensaje");
       window.document.contactoForm.mensaje.select();
       return false;
       }
    return true
    }


function isBlanco(texto){
   largo = texto.length
   for (i=0; i < largo ; i++ )
       if ( texto.charAt(i) !=" ")
          return false;
return true
}

function isValidEmail(texto){
  var addressIsValid = false;
  var invalidPatterns = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
  var validPatterns = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
  if (window.RegExp){
    if (!invalidPatterns.test(texto) && validPatterns.test(texto)){
      addressIsValid = true;
    }else{
         addressIsValid = false;
    }
  }else {
       if(texto.indexOf("@") >= 0)
       	addressIsValid = true;
       }
return addressIsValid;
}

