Calling function on window load instead of document load