  A detachment of a hypergraph is formed by splitting each vertex into one or
more subvertices, and sharing the incident edges arbitrarily among the
subvertices. For a given edge-colored hypergraph $\scr F$, we prove that there
exists a detachment $\scr G$ such that the degree of each vertex and the
multiplicity of each edge in $\scr F$ (and each color class of $\scr F$) are
shared fairly among the subvertices in $\scr G$ (and each color class of $\scr
G$, respectively).
  Let $(\lambda_1\dots,\lambda_m) K^{h_1,\dots,h_m}_{p_1,\dots,p_n}$ be a
hypergraph with vertex partition $\{V_1,\dots, V_n\}$, $|V_i|=p_i$ for $1\leq
i\leq n$ such that there are $\lambda_i$ edges of size $h_i$ incident with
every $h_i$ vertices, at most one vertex from each part for $1\leq i\leq m$ (so
no edge is incident with more than one vertex of a part). We use our detachment
theorem to show that the obvious necessary conditions for
$(\lambda_1\dots,\lambda_m) K^{h_1,\dots,h_m}_{p_1,\dots,p_n}$ to be expressed
as the union $\scr G_1\cup \ldots \cup\scr G_k$ of $k$ edge-disjoint factors,
where for $1\leq i\leq k$, $\scr G_i$ is $r_i$-regular, are also sufficient.
Baranyai solved the case of $h_1=\dots=h_m$, $\lambda_1=\dots,\lambda_m=1$,
$p_1=\dots=p_m$, $r_1=\dots =r_k$. Berge and Johnson, (and later Brouwer and
Tijdeman, respectively) considered (and solved, respectively) the case of
$h_i=i$, $1\leq i\leq m$, $p_1=\dots=p_m=\lambda_1=\dots=\lambda_m=r_1=\dots
=r_k=1$. We also extend our result to the case where each $\scr G_i$ is almost
regular.
