wow dude: that's an awfull lot of code. but here's what i found:
1. you forgot to close the following if:
i assume this should be closed right before:
2. you forgot to close the following if as well:
A good way to check if all if's are closed, is to delete all closed if's. You start from the deepest if (the if in the if in the if, ....), and then you go all the way up.
I noticed that you're repeating tons of code. I recommend you to take a look into function. They will speed up your program, and it make the code a much better to handle.
means that you forgot to close an if, while, for, foreach, etc...
UnrealEd