  We introduce a general notion of depth two for ring homomorphism N --> M, and
derive Morita equivalence of the step one and three centralizers, R = C_M(N)
and C = End_{N-M}(M \o_N M), via dual bimodules and step two centralizers A =
End_NM_N and B = (M \o_N M)^N, in a Jones tower above N --> M. Lu's
bialgebroids End_k A' and A' \o_k {A'}^op over a k-algebra A' are generalized
to left and right bialgebroids A and B with B the R-dual bialgebroid of A. We
introduce Galois-type actions of A on M and B on End_NM when M_N is a balanced
module. In the case of Frobenius extensions M | N, we prove an endomorphism
ring theorem for depth two. Further in the case of irreducible extensions, we
extend previous results on Hopf algebra and weak Hopf algebra actions in
subfactor theory [Szymanski, Nikshych-Vainerman] and its generalizations
[Kadison-Nikshych: RA/0107064, RA/0102010] by methods other than nondegenerate
pairing. As a result, we have concrete expressions for the Hopf or weak Hopf
algebra structures on the step two centralizers. Semisimplicity of B is
equivalent to separability of the extension M | N. In the presence of depth
two, we show that biseparable extensions are QF.
