Fixed some accidental globals and a method typo.

trackNotificationSent had a typo on line 346 that prevented the success callback from firing.  Also, a couple of for loops didn't declare their i variables, causing a global i in the window namespace.