move function onLoad out of if statement to ensure hoisting in firefox