You say you have errors- I suggest you post them, along with which lines they're talking about.

Also, when you post code, it should be in the form of an SSCCE (as short as possible while still...