Yikes. There are so many things wrong with that code that it is no clear what it's doing right, let alone what it's doing wrong.

1) The indentation is pitiful, making it difficult to...