DDF-66: Modified javascript to be ie8 friendly