public JSWindow jsFunction_waitNewWindow(String name, int timeout) {
            deprecated();
            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)) {

                    int rid = UI.instance.getId(JSBotUtils.lastCreatedWindow);
                    if (!(UI.instance.getWidget(rid) instanceof Window)) continue;
                    JSWindow ret = new JSWindow(rid);
                    JSBotUtils.lastCreatedWindow = null;
                    return ret;
                }
                Sleep(25);
                curr += 25;
            }
            return null;
        }