separate wait page loading with a global variable