void script_1046(int arg0,int arg1,int arg2,int arg3,int arg4,int arg5,int arg6) {
	int ivar7;
	int ivar8;
	int ivar9;
	int ivar10;
	ivar7 = 1;
	ivar8 = 0;
	ivar9 = 1000;
	ivar10 = -1;
	if (isAlphaNumeric(((char)arg1))) {
		while (ivar8 < arg6) {
			if ((setWidgetRegister(new WidgetPointer(arg3), add(script_1844(ivar8), 1)) && ((boolean)strIndexof(((char)lower(((char)arg1))), 0, lower(getWidgetText())))) && setWidgetRegister(new WidgetPointer(arg3), 0)) {
				setWidgetPosition(getWidgetActualX(), getWidgetActualY(), 0, 0);
				setWidgetSize(getWidgetActualWidth(), getWidgetActualHeight(), 0, 0);
				setWidgetRGB(new Color(87, 126, 69));
				setWidgetFilled(1);
				if (ivar8 < globalint_128) {
					if (getWidgetActualY() < cs2method2601(new WidgetPointer(arg3))) {
						script_72(arg4, arg3, getWidgetActualY());
					}
				} else {
					if ((ivar8 > globalint_128) && (add(getWidgetActualY(), getWidgetActualHeight()) > add(getWidgetActualHeight(new WidgetPointer(arg3)), cs2method2601(new WidgetPointer(arg3))))) {
						script_72(arg4, arg3, subtract(add(getWidgetActualY(), getWidgetActualHeight()), getWidgetActualHeight(new WidgetPointer(arg3))));
					}
				}
				globalint_128 = ivar8;
				return;
			}
			ivar8 = add(ivar8, 1);
		}
		return;
	}
	if (arg0 == 104) {
		if (((boolean)arg6)) {
			return;
		}
		if (globalint_128 <= 0) {
			globalint_128 = subtract(arg6, 1);
		} else {
			globalint_128 = subtract(globalint_128, 1);
		}
		if (setWidgetRegister(new WidgetPointer(arg3), add(script_1844(globalint_128), 1))) {
			if (setWidgetRegister(new WidgetPointer(arg3), 0)) {
				setWidgetPosition(getWidgetActualX(), getWidgetActualY(), 0, 0);
				setWidgetSize(getWidgetActualWidth(), getWidgetActualHeight(), 0, 0);
				setWidgetRGB(new Color(87, 126, 69));
				setWidgetFilled(1);
			}
			if (getWidgetActualY() < cs2method2601(new WidgetPointer(arg3))) {
				script_72(arg4, arg3, subtract(cs2method2601(new WidgetPointer(arg3)), getWidgetActualHeight()));
			} else {
				if (add(getWidgetActualY(), getWidgetActualHeight()) > add(getWidgetActualHeight(new WidgetPointer(arg3)), cs2method2601(new WidgetPointer(arg3)))) {
					script_72(arg4, arg3, getWidgetScrollMaxV(new WidgetPointer(arg3)));
				}
			}
		}
		return;
	}
	if (arg0 == 105) {
		if (((boolean)arg6)) {
			return;
		}
		if (globalint_128 == subtract(arg6, 1)) {
			globalint_128 = 0;
		} else {
			globalint_128 = add(globalint_128, 1);
		}
		if (setWidgetRegister(new WidgetPointer(arg3), add(script_1844(globalint_128), 1))) {
			if (setWidgetRegister(new WidgetPointer(arg3), 0)) {
				setWidgetPosition(getWidgetActualX(), getWidgetActualY(), 0, 0);
				setWidgetSize(getWidgetActualWidth(), getWidgetActualHeight(), 0, 0);
				setWidgetRGB(new Color(87, 126, 69));
				setWidgetFilled(1);
			}
			if (add(getWidgetActualY(), getWidgetActualHeight()) > add(getWidgetActualHeight(new WidgetPointer(arg3)), cs2method2601(new WidgetPointer(arg3)))) {
				script_72(arg4, arg3, add(cs2method2601(new WidgetPointer(arg3)), getWidgetActualHeight()));
			} else {
				if (getWidgetActualY() < cs2method2601(new WidgetPointer(arg3))) {
					script_72(arg4, arg3, 0);
				}
			}
		}
		return;
	}
	if (arg0 == 102) {
		script_1050(globalint_126, globalstring_27);
		return;
	}
	if (arg0 == 13) {
		script_1054();
		return;
	}
	if (arg0 == 84) {
		if ((globalint_128 >= 0) && setWidgetRegister(new WidgetPointer(arg3), add(globalint_128, 1))) {
			script_1074(arg2, arg5, script_1844(globalint_128));
		}
		return;
	}
	if (arg0 == 85) {
		if (((boolean)globalint_127)) {
			script_1054();
		} else {
			globalint_128 = -1;
			setWidgetIsHidden(true, new WidgetPointer(137,7));
			setWidgetIsHidden(true, new WidgetPointer(137,9));
			setWidgetIsHidden(true, new WidgetPointer(137,13));
			setWidgetIsHidden(false, new WidgetPointer(137,17));
			setWidgetIsHidden(false, new WidgetPointer(137,1));
			setWidgetIsHidden(true, new WidgetPointer(137,3));
		}
		return;
	}
	return;
}
