Copy from http://spjsfiles.com/index.php?dir=SharePoint+JavaScripts%2Fspjs-utility%2F with refactorings.