Hard geometry question (circles and triangles) Could anyone solve this one for me? I tried to use some kind of variation on Poncelet's theorem, but couldn't find a way to do it. Here it goes:

Let $ABC$ be a triangle and $D\in BC$ such that $AD\perp BC$. Also, let $I$ and $J$ be the incenters of triangles $ABD$ and $ACD$, respectively. The incircles of $ABD$ and $ACD$ are tangents to $AD$ on dots $M$ and $N$, respectively. Finally, let $P$ be the point of tangency of $ABC$'s incircle with side $AB$. The circle centered in $A$ and with radius $AP$ intersects $AD$ in $K$.
a) Show that triangles $IMK$ and $KNJ$ are congruent.
b) Show that $IDJK$ is cyclical.

I didn't have a problem with the image. Here's how I saw it:

I couldn't find a relation between the last circle built and the other ones. And to prove congruence I have to do so, since $K$ is one of both triangles' vertices, and it's built from that specifical circle. So, anyone, please?
 A: Before we start, let us recall how to compute the distance between a vertex
and the nearby points where the incircle touch the triangle.

Given any triangle $ABC$, let $a = BC, b = CA, c = AB$. The incircle of $ABC$ will touch the sides of triangle at three points. Let $P, Q, R$ be the points on sides $AB$, $BC$, $CA$ respectively. Notice
  $$\begin{cases}AP = AR,\\
BP = BQ,\\ 
CQ = CR\end{cases}
\quad\text{ and }\quad
\begin{cases}
AP + PB = AB = c,\\ BQ + QC = BC = a,\\ CR + RA = CA = b
\end{cases}$$
     We have
  $$\begin{align}AP &= \frac12(AP + AR)\\
&= \frac12((AP+PB) + (AR+RC) - (QC+BC))\\
&= \frac12(b + c - a)\end{align}$$

For the problem at hand, let $h = AD, u = BD, v = CD$, we have $a = u+v$.
Apply above theorem to $\triangle ABC$, $\triangle ADB$ and $\triangle DAC$, we get
$$AK = AP = \frac12(b+c-a),\quad
  AM = \frac12(h+c-u)\quad\text{ and }\quad
  ND = \frac12(h+v-b)$$
This leads to
$$\begin{align}KM = AM - AK &= \frac12( (h + c - u ) - (b+c - (u+v))\\
&= \frac12(h + v - b) = ND\end{align}$$
Since $\angle ADC = 90^\circ$, $ND = JN$ and hence $KM = JN$.
Similarly,
$$\begin{align}KN = AD - AK - ND 
&= h - \frac12(b+c-a) - \frac12(h+v-b) \\
&= \frac12(2h - b - c + (u+v) - h - v + b)\\
&=\frac12(h + u - c) = MD\end{align}$$
Since $\angle BDA = 90^\circ$, $MD = IM$ and hence $KN = IM$.
It is clear $\angle IMK = \angle KNJ = 90^\circ$. By SAS, $\triangle IMK$ is congurent to $\triangle KNJ$.
Notice
$$\begin{align}\angle DJK + \angle KID 
&= ( \angle DJN + \angle NJK ) + ( \angle KIM + \angle MID )\\
& = (45^\circ + \angle NJK ) + (\angle JKN + 45^\circ)\\
&= 90^\circ + (\angle NJK + \angle JKN)\\
&= 90^\circ + (180^\circ - \angle KNJ)\\
&= 90^\circ + 180^\circ - 90^\circ
= 180^\circ\end{align}$$
The quadrilateral $IKJD$ is cyclic.
