Compilation of useful php functions ported over to javascript.