Better javascript event startup