Got it to work.
The only thing I'm figuring out now is how to make the alert contain all the alerts in one message.
I tried "var popupMessage", but can you use that within a function?
Here is my code:
http://pastebin.com/m10bf1316
I put the alerts near the top and it's easier to see.