Fixing js error in firefox - jquery being used before it has loaded