refactoring jquery for ajaxpages