public static boolean jWaitWindow(String name, int timeout) {
        int curr = 0;
        if (timeout == 0) timeout = 10000;
        while (curr < timeout) {
            if (JSBotUtils.lastCreatedWindow != null &&
                    JSBotUtils.lastCreatedWindow.cap.text != null &&
                    JSBotUtils.lastCreatedWindow.cap.text.equals(name)) {
                JSBotUtils.lastCreatedWindow = null;
                return true;
            }
            if (!JSBot.Sleep(25)) return false;
            curr += 25;
        }
        return false;
    }