The script is fine. This might have something to do with bg class assigned to bg_img image. Probably, the bg has some unsupportable attribute which not work with FF.
EDIT:
To change the background of your page, why don't you just replace the document.bg_img.src with document.body.background.
Ramiz Uddin
2009-12-17 06:27:44