Improper integrals - where am I going wrong? The question asks:
$\int_0^\pi \frac{sinx}{\sqrt{|cosx|}}$  
My attempt:
$\lim\limits_{t \to \frac{\pi}{2}^-} \int_0^t \frac{sinx}{\sqrt{|cosx|}}$ + $\lim\limits_{t \to \frac{\pi}{2}^+} \int_t^\pi \frac{sinx}{\sqrt{|cosx|}}$
$\int \frac{sinx}{\sqrt{|cosx|}} = -2\sqrt{|cosx|}$  
$\lim\limits_{t \to \frac{\pi}{2}^-} [-2\sqrt{|cosx|}]_0^t = 2$
$\lim\limits_{t \to \frac{\pi}{2}^+} [-2\sqrt{|cosx|}]_t^\pi = -2$
$\lim\limits_{t \to \frac{\pi}{2}^-} [-2\sqrt{|cosx|}]_0^t + \lim\limits_{t \to \frac{\pi}{2}^+} [-2\sqrt{|cosx|}]_t^\pi = 0$  
My final answer is $0$, but the marking scheme shows the final answer as $4$.  
I also notice the following step from the marking scheme:
$\int_0^\pi \frac{sinx}{\sqrt{|cosx|}}$ = $2\int_0^\frac{\pi}{2} \frac{sinx}{\sqrt{|cosx|}}$
I do not understand how the marking scheme arrived to this step.  
I have been struggling with this question for too long now. Could someone please help me get to the correct answer? I will appreciate that.
Thanks

Note that after $\frac {\pi} 2$,  cosine is negative,  so the absolute value function in your second integral will have a -cos(x) in the bottom.  That'll add an extra - to your antiderivative of the second part,  which flips it from -2 to 2
