How Do I get Custody of My Grandchild?

Hi my daughter (39) who dont have a job, no money, no husband & she lives in a apt that is moldy and in disrepair, recently gave birth to my grandchild in Nov 08. I have had my grandchild at my house since 4 days after she was born, it is now May 09 and shes still here. Her mother comes to visit only, but doesn't seem to have any plans on getting a job nor moving to a decent residence so she can have the child back. In April she wrote out & signed an agreement(not a legal document) stating that she gives me and my husband temporary guardiandship of my granchild for a year so that she can get herself together. What are we to do with this? She abandoned 1 child to us 20yrs ago (we didn't seek custody then) & now here she is doing it again (this time we are seeking custody. Please help.