Calling Sub-Function in Javascript Different in Safari