improve method for determining window width
add better paging through the modals using the Previous and Next buttons