some javascript boilerplate