jQuery plugin for history management