  In the first part of the paper, we develop a theory of crossed products of a
$C^*$-algebra $A$ by an arbitrary (not necessarily extendible) endomorphism
$\alpha:A\to A$. We consider relative crossed products $C^*(A,\alpha;J)$ where
$J$ is an ideal in $A$, and describe up to Morita-Rieffel equivalence all gauge
invariant ideals in $C^*(A,\alpha;J)$ and give six term exact sequences
determining their $K$-theory. We also obtain certain criteria implying that all
ideals in $C^*(A,\alpha;J)$ are gauge invariant, and that $C^*(A,\alpha;J)$ is
purely infinite.
  In the second part, we consider a situation where $A$ is a $C_0(X)$-algebra
and $\alpha$ is such that $\alpha(f a)=\Phi(f)\alpha(a)$, $a\in A$, $f\in
C_0(X)$ where $\Phi$ is an endomorphism of $C_0(X)$. Pictorially speaking,
$\alpha$ is a mixture of a topological dynamical system $(X,\varphi)$ dual to
$(C_0(X),\Phi)$ and a continuous field of homomorphisms $\alpha_x$ between the
fibers $A(x)$, $x\in X$, of the corresponding $C^*$-bundle.
  For systems described above, we establish efficient conditions for the
uniqueness property, gauge-invariance of all ideals, and pure infiniteness of
$C^*(A,\alpha;J)$. We apply these results to the case when $X=$Prim$(A)$ is a
Hausdorff space. In particular, if the associated $C^*$-bundle is trivial, we
obtain formulas for $K$-groups of all ideals in $C^*(A,\alpha;J)$. In this way,
we constitute a large class of crossed products whose ideal structure and
$K$-theory is completely described in terms of $(X,\varphi,\{\alpha_{x}\}_{x\in
X};Y)$ where $Y$ is a closed subset of $X$.

Operator Algebras