  This paper provides a homological algebraic foundation for generalizations of
classical Hecke algebras introduced in math.QA/9805134. These new Hecke
algebras are associated to triples of the form (A,B,e), where A is an
associative algebra containing subalgebra B with character e.
  These algebras are connected with cohomology of associative algebras in the
sense that for every left A-module V and right A-module W the Hecke algebra
associated to triple (A,B,e) naturally acts in the B-cohomology and B-homology
spaces of V and W, respectively.
  We also introduce the semi-infinite cohomology functor for associative
algebras and define modifications of Hecke algebras acting in semi-infinite
cohomology spaces. We call these algebras semi-infinite Hecke algebras.
  As an example we realize the W-algebra W(g) associated to a complex
semisimple Lie algebra g as a semi-infinite Hecke algebra. Using this
realization we explicitly calculate the algebra W(g) avoiding the bosonization
technique used by Feigin and Frenkel.
