try window load instead of document ready