//funciones para la comprobacion de los formularios de alta
function Frm_Val(theForm)
{
  if (theForm.NombreEmpresa.value == "")
  {
    alert("El campo NOMBRE JURIDICO DE LA EMPRESA es obligatorio");
    theForm.NombreEmpresa.focus();
    return (false);
  }

    if (theForm.DenomComercial.value == "")
  {
    alert("El campo DENOMINACION COMERCIAL es obligatorio");
    theForm.DenomComercial.focus();
    return (false);
  }

    if (theForm.CIF.value == "")
  {
    alert("El campo C.I.F es obligatorio");
    theForm.CIF.focus();
    return (false);
  }

  var checkOK = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
  var checkStr = theForm.CIF.value;
  var allValid = true;
  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;
    }
  }
  if (!allValid)
  {
    alert("El campo CIF es incorrecto. Indique el numero y la letra todo seguido");
    theForm.CIF.value = "";
    theForm.CIF.focus();
    return (false);
  }

    if (theForm.CIF.value.length > 9)
  {
    alert("El campo C.I.F debe tener un maximo de 8 caracteres.");
    theForm.CIF.focus();
    return (false);
  }
   
	if (theForm.Pers_Contacto.value == "")
  {
    alert("El campo PERSONA DE CONTACTO es obligatorio");
    theForm.Pers_Contacto.focus();
    return (false);
  }

    if (theForm.Direccion.value == "")
  {
    alert("El campo DIRECCION es obligatorio");
    theForm.Direccion.focus();
    return (false);
  }

	  if (theForm.Poblacion.value == "")
  {
    alert("El campo POBLACION es obligatorio");
    theForm.Poblacion.focus();
    return (false);
  }

      if (theForm.CPostal.value == "")
  {
    alert("El campo CODIGO POSTAL es obligatorio");
    theForm.CPostal.focus();
    return (false);
  }

      if (theForm.Provincia.value == "")
  {
    alert("El campo PROVINCIA es obligatorio");
    theForm.Provincia.focus();
    return (false);
  }

      if (theForm.Telefono.value == "")
  {
    alert("El campo TELEFONO es obligatorio");
    theForm.Telefono.focus();
    return (false);
  }

        if (theForm.Fax.value == "")
  {
    alert("El campo FAX es obligatorio");
    theForm.Fax.focus();
    return (false);
  }

      if (theForm.EMail.value == "")
  {
    alert("El campo E-MAIL es obligatorio");
    theForm.EMail.focus();
    return (false);
  }

      if (theForm.Username.value == "")
  {
    alert("El campo NOMBRE DE USUARIO es obligatorio");
    theForm.Username.focus();
    return (false);
  }

      if (theForm.Passw.value == "")
  {
    alert("El campo CONTRASEÑA es obligatorio");
    theForm.Passw.focus();
    return (false);
  }

      if ((theForm.Passw.value.length < 4) || (theForm.Passw.value.length > 10))
  {
    alert("El campo CONTRASEÑA debe tener un mínimo de 4 caracteres y un máximo de 10");
    theForm.Passw.focus();
    return (false);
  }

    if (theForm.Passw.value != theForm.Password2.value)
  {
    alert("No se ha podido verificar la contraseña. Por favor, intentalo de nuevo.");
    theForm.Passw.value="";
    theForm.Password2.value="";
    theForm.Passw.focus();
    return (false);
  }

        if (theForm.TextoPublicitario.value == "")
  {
    alert("El campo TEXTO PUBLICITARIO es obligatorio");
    theForm.TextoPublicitario.focus();
    return (false);
  }

        if (theForm.Keywords.value == "")
  {
    alert("El campo Claves de Búsqueda es obligatorio");
    theForm.Keywords.focus();
    return (false);
  }

  return (true);
}