Ok that would explain why FFox was highlighting the script tag bright red in my source code - I'll move it and try again at work tomorrow. Right now it is outputting the right value when I set that variable to be displayed in an alert ("templateCollection"), so that's a step in the right direction.
But my new class is still not getting added in.
Baby steps - this is further than I got earlier today so I'm happy. Any further suggestions would be appreciated. Thank you both.