moved onvisibilitychange from Mike's review