Javascript Javascript DOM Event onoffline