storing a password in a cookie is about the most stupid thing to do. You may want to take a look at the article "a secure authentication system" on this site ...
I have also posted a question which holds the answer to your question on this forum but I'm too lazy to search for it myself... maybe you can find it...