Effective-medium theory of chemical binding: Application to chemisorption