Cross-browser, all wrapped up in one function