added the load check for popup window before function calls