Modifications to Javascript so that it works in Firefox