Integration problem with maximum function inside integral

Hello. I have two questions, I'll be extremely cheerful if anyone can provide an answer.

I have got two equations as follows

$\displaystyle r*U=b+\alpha _{0}*\int_{w_{R}}^{\infty}[W(w)-U]dF(w)$ (1)

$\displaystyle r*W(w)=w+\alpha _{1}*\int_{0}^{\infty}\max (0,W(w^{'})-W(w)))dF(w')+\lambda [U-W(w)]$ (2)

where w' is not the derivative of w, but just describing another value of w.

He says: Let $\displaystyle W(w_{R})=U$, then he evaluates the equation (2) at $\displaystyle w=w_{R}$ (so he gets r*U=....)

Then combines this with (1), (Because (1) and the (2) evaluated at $\displaystyle w=w_{R}$ are equal) to solve for $\displaystyle w_{R}$:

to get: $\displaystyle w_{R}=b+(\alpha _{0}-\alpha _{1})\int_{w_{R}}^{\infty }[W(w')-U]dF(w')$

Now my problem is: how does he actually gets that final equation? Because I cannot manage to evaluate (2) at $\displaystyle w=w_{R}$ because that maximum function in the integral really confuses me. Moreover, I don't understand how he merges two integrals with different intervals.

Okay this was the first question.

Second one is, he differentiates the equation (2) to get

$\displaystyle W'(w)=(r+\lambda +\alpha _{1}[1-F(w)])^{-1}$

I can't manage to get this either. I get all my problems come down to that integral with a maximum function in it.

Okay, I hope I could describe it well enough.

Cheers

Burak