set of javascript helper functions