I like these helper functions :)

There must be a JS library that does these kinds of things...