Javascript to convert between states and abbreviations

In this post, Sean Barton provides a nifty script for converting between U.S. states and their abbreviations.
I needed this functionality in js/jquery, so here it is! Feel free to convert this to plain javascript.