simple JavaScript grid implementation