
function checkForm(theForm)
{

 if (theForm.menuDept1.value == "0")
  {
    alert("Por favor seleccione 'Tipo de inmueble'.");
    theForm.menuDept1.focus();
    return (false);
  }

 
 if (theForm.menuDept2.value == "0")
  {
    alert("Por favor seleccione 'Localidad'.");
    theForm.menuDept2.focus();
    return (false);
  }


 if (theForm.menuDept3.value == "0")
  {
    alert("Por favor seleccione 'Modalidad'.");
    theForm.menuDept3.focus();
    return (false);
  }

 if (theForm.desdePrecio.value == "")
  {
    alert("Por favor introduzca un rango de búsqueda para el precio.");
    theForm.desdePrecio.focus();
    return (false);
  }
  var checkOK = "0123456789";
  var checkStr = theForm.desdePrecio.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("Debe introducir sólo números en el campo \"Precio\".");
    theForm.desdePrecio.focus();
    return (false);
  }

 if (theForm.hastaPrecio.value == "")
  {
    alert("Por favor introduzca un rango de búsqueda para el precio.");
    theForm.hastaPrecio.focus();
    return (false);
  }
  var checkOK = "0123456789";
  var checkStr = theForm.hastaPrecio.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("Debe introducir sólo números en el campo \"Precio\".");
    theForm.hastaPrecio.focus();
    return (false);
  }


if (theForm.desdePrecio.value > theForm.hastaPrecio.value)
  {
    alert("El campo 'Desde' no puede ser mayor que el campo 'Hasta'.");
    theForm.desdePrecio.focus();
    return (false);
  }

  
  return (true);
}
