Here is where some good coding practices come into play.
I don't want to repeat what is covered in the article below, so take a look (the article is written with IE in mind, but it very well applies to FF too or basically better coding practices).
- Declare var for variables that are meant to have local scope
- Cache Variables Whenever Possible
- Cache Function Pointers at all costs
- Avoid Using the ‘with’ Keyword