javascript controller