  Let g be a semi-simple Lie algebra. In this paper we study the spaces of
based quasi-maps from the projective line P^1 to the flag variety of g (it is
well-known that their singularities are supposed to model the singularities of
the so called semi-infinite Schubert varieties which are hard to define
directly). In the first part of the paper we show that the above spaces are
normal and in the case when g is simply laced they are also Gorenstein and have
rational singularities. In the second part of the paper we compute the
character of the ring of functions on the above spaces; in view of the above
results this computation can be thought of as a computation of the
(equivariant) K-theoretic J-function of the flag variety of g. We show that
when g is simply laced the above characters satisfy the "fermionic recursion"
version of the difference quantum Toda lattice (due to B.Feigin, E.Feigin,
M.Jimbo, T.Miwa and E.Mukhin). As a byproduct we show that the equivariant
K-theoretic J-function of the flag variety of a simply laced Lie algebra g is
the universal eigen-function of the difference quantum Toda lattice, thus
proving a conjecture of Givental and Lee. Some modification of this result is
also shown to hold for non-simply laced g.
  We also discuss an extension of the above results to the case when g is an
affine Lie algebra (this extension is conjectural except when g=sl(N)).
