modify javascript to support firefox better