public static void imgClick(String wnd, int pos, int button, int mod) {
        if (pos < 1)
            pos = 1;
        int imgPos = 0;
        Widget root = UI.instance.root;
        for (Widget wdg = root.child; wdg != null; wdg = wdg.next) {
            if (wdg instanceof Window)
                if (((Window) wdg).cap.text.equals(wnd))
                    for (Widget img = wdg.child; img != null; img = img.next)
                        if (img instanceof Img) {
                            Img i = (Img) img;
                            if (i != null) {
                                if (i.textureName.contains("/invsq")) continue;
                                imgPos++;
                                if (imgPos == pos) {
                                    i.wdgmsg("click", new Coord(0, 0), button, mod);
                                    return;
                                }
                            }
                        }
        }
    }