I am in danger of losing my kids because of my addiction. What can I do?

Get Clean! Addiction in and of itself causes a preoccupation with the addictive behavior. Courts will not allow those who are more preoccupied with themselves and their addictions, the privilege and responsibility of parenthood, and caring for their kids.
Follow the plan. Get involved with court appointed child advocate program in your area - http://www.Casaforchildren.Org/ and they have volunteers who will work on behalf of the child to get the best possible outcome and you can have support from them. If you are already involved with social services you need to follow through your plan of action and not slip up. It is ultimately decided in best interest of child.