What errors are thrown? Also, can you format your code so that it is easier to read(i.e. tab things over, comment things out, etc.)?

--- Update ---

And use the code tags when posting chunks of...