ESO imaging survey. II. Searching for distant clusters of galaxies