Javascript stack based screen management