Please re-edit your post to use proper code tags. It is almost impossible to read as the code is unformatted.

Second, what debugging have you done, besides just running the program and saying it...