A handy set of Javascript methods for general use