How to calculate this angle?

Hello all. I am working on a game, and I have a situation where I need to calculate an angle, but I have no idea where to start :) So I will try to illustrate the problem for you (literally).

http://www.spudgames.com/stuff/joint...alculation.jpg

The B and D arm can both rotate at the red circles (joints), and this in turn allows the C arm to move up and down. A is static, and cannot move. I need to be able to calculate the angle at joint 2 (between C and D) when joint 2 is moved up and down.

Anyone have any thoughts on how I would do this?

Thanks!

Jade