Updated for use with jQuery 1.9