How do I find the equations of movement of this system? I do not know how to determine the kinetic energy "$T$" and the potential energy "$V$". Any suggestions?. I know that the Lagrangian is of the form $L = T-V$ but my question is how to determine the energies $T$ and $V$.
It is the following system:

A little help
First the potential energy $V$
$$ V=h_{1}m_{1}g+h_{2}m_{2}g $$
with the restrictions
$$ \begin{array}{rcl} X_{m_{1}}+X_{m_{2}} & = & L_{0}\\ h_{1} & = & (L_{0}-X_{m_{2}})\sin\alpha\\ h_{2} & = & X_{m_{2}}\sin\beta \end{array} $$
Now concerning the velocities
$$ \frac{dX_{m_{1}}}{dt}+\frac{dX_{m_{2}}}{dt}=v_{1}+v_{2}=0,\:v_{3}=\frac{dX_{M}}{dt} $$
Now the kinetic energy $T$
$$ T=\frac{1}{2}m_{1}\left\Vert \vec{V_{1}}\right\Vert ^{2}+\frac{1}{2}m_{2}\left\Vert \vec{V_{2}}\right\Vert ^{2}+\frac{1}{2}M\left\Vert \vec{V}_{3}\right\Vert ^{2} $$
where
$$ \begin{array}{rcl} \vec{V_{1}} & = & \hat{i}v_{3}-(\hat{i}\cos\alpha+\hat{j}\sin\alpha)v_{1}\\ \vec{V_{2}} & = & \hat{i}v_{3}+(\hat{i}\cos\beta-\hat{j}\sin\beta)v_{2}\\ \vec{V_{3}} & = & \hat{i}v_{3} \end{array} $$
$$ T = \frac{1}{2}\left(m_1v_1^2+m_2 v_2^2+(M+m_1+m_2)v_3^2-2m_1v_1v_3\cos(\alpha)+2m_2v_2v_3\cos(\beta)\right) $$
etc.
NOTE
Here there are two generalized coordinates: $X_{m_2}$ and $X_M$ because $X_{m_1}+X_{m_2} = L_0$
Calling $\phi_1 = X_{m_2}$ and $\phi_2 = X_M$ we have
$$ V = (L_0-\phi_1)m_1g\sin(\alpha) + \phi_1m_2 g\sin(\beta) $$
and
$$ T = \frac{1}{2}\left(m_1\dot \phi_1^2+m_2 \dot \phi_1^2+(M+m_1+m_2)\dot \phi_2^2-2m_1 \dot \phi_1\dot\phi_2\cos(\alpha)-2m_2\dot\phi_1\dot\phi_2\cos(\beta)\right) $$